| 117 | #endif |
| 118 | |
| 119 | static void executor_free(AVExecutor *e, const int has_lock, const int has_cond) |
| 120 | { |
| 121 | if (e->thread_count) { |
| 122 | //signal die |
| 123 | ff_mutex_lock(&e->lock); |
| 124 | e->die = 1; |
| 125 | ff_cond_broadcast(&e->cond); |
| 126 | ff_mutex_unlock(&e->lock); |
| 127 | |
| 128 | for (int i = 0; i < e->thread_count; i++) |
| 129 | executor_thread_join(e->threads[i].thread, NULL); |
| 130 | } |
| 131 | if (has_cond) |
| 132 | ff_cond_destroy(&e->cond); |
| 133 | if (has_lock) |
| 134 | ff_mutex_destroy(&e->lock); |
| 135 | |
| 136 | av_free(e->threads); |
| 137 | av_free(e->local_contexts); |
| 138 | |
| 139 | av_free(e); |
| 140 | } |
| 141 | |
| 142 | AVExecutor* av_executor_alloc(const AVTaskCallbacks *cb, int thread_count) |
| 143 | { |
no test coverage detected