| 108 | static int skip_first_line; |
| 109 | |
| 110 | static void add_work(struct grep_opt *opt, struct grep_source *gs) |
| 111 | { |
| 112 | if (opt->binary != GREP_BINARY_TEXT) |
| 113 | grep_source_load_driver(gs, opt->repo->index); |
| 114 | |
| 115 | grep_lock(); |
| 116 | |
| 117 | while ((todo_end+1) % ARRAY_SIZE(todo) == todo_done) { |
| 118 | pthread_cond_wait(&cond_write, &grep_mutex); |
| 119 | } |
| 120 | |
| 121 | todo[todo_end].source = *gs; |
| 122 | todo[todo_end].done = 0; |
| 123 | strbuf_reset(&todo[todo_end].out); |
| 124 | todo_end = (todo_end + 1) % ARRAY_SIZE(todo); |
| 125 | |
| 126 | pthread_cond_signal(&cond_add); |
| 127 | grep_unlock(); |
| 128 | } |
| 129 | |
| 130 | static struct work_item *get_work(void) |
| 131 | { |
no test coverage detected