| 3162 | } |
| 3163 | |
| 3164 | static void *threaded_find_deltas(void *arg) |
| 3165 | { |
| 3166 | struct thread_params *me = arg; |
| 3167 | |
| 3168 | progress_lock(); |
| 3169 | while (me->remaining) { |
| 3170 | progress_unlock(); |
| 3171 | |
| 3172 | find_deltas(me->list, &me->remaining, |
| 3173 | me->window, me->depth, me->processed); |
| 3174 | |
| 3175 | progress_lock(); |
| 3176 | me->working = 0; |
| 3177 | pthread_cond_signal(&progress_cond); |
| 3178 | progress_unlock(); |
| 3179 | |
| 3180 | /* |
| 3181 | * We must not set ->data_ready before we wait on the |
| 3182 | * condition because the main thread may have set it to 1 |
| 3183 | * before we get here. In order to be sure that new |
| 3184 | * work is available if we see 1 in ->data_ready, it |
| 3185 | * was initialized to 0 before this thread was spawned |
| 3186 | * and we reset it to 0 right away. |
| 3187 | */ |
| 3188 | pthread_mutex_lock(&me->mutex); |
| 3189 | while (!me->data_ready) |
| 3190 | pthread_cond_wait(&me->cond, &me->mutex); |
| 3191 | me->data_ready = 0; |
| 3192 | pthread_mutex_unlock(&me->mutex); |
| 3193 | |
| 3194 | progress_lock(); |
| 3195 | } |
| 3196 | progress_unlock(); |
| 3197 | /* leave ->working 1 so that this doesn't get more work assigned */ |
| 3198 | return NULL; |
| 3199 | } |
| 3200 | |
| 3201 | static void ll_find_deltas(struct object_entry **list, unsigned list_size, |
| 3202 | int window, int depth, unsigned *processed) |
nothing calls this directly
no test coverage detected