MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / thread_worker

Function thread_worker

libavutil/slicethread.c:71–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71static void *attribute_align_arg thread_worker(void *v)
72{
73 WorkerContext *w = v;
74 AVSliceThread *ctx = w->ctx;
75
76 pthread_mutex_lock(&w->mutex);
77 pthread_cond_signal(&w->cond);
78
79 while (1) {
80 w->done = 1;
81 while (w->done)
82 pthread_cond_wait(&w->cond, &w->mutex);
83
84 if (ctx->finished) {
85 pthread_mutex_unlock(&w->mutex);
86 return NULL;
87 }
88
89 if (run_jobs(ctx)) {
90 pthread_mutex_lock(&ctx->done_mutex);
91 ctx->done = 1;
92 pthread_cond_signal(&ctx->done_cond);
93 pthread_mutex_unlock(&ctx->done_mutex);
94 }
95 }
96}
97
98av_cold
99int avpriv_slicethread_create(AVSliceThread **pctx, void *priv,

Callers

nothing calls this directly

Calls 5

run_jobsFunction · 0.85
pthread_mutex_lockFunction · 0.50
pthread_cond_signalFunction · 0.50
pthread_cond_waitFunction · 0.50
pthread_mutex_unlockFunction · 0.50

Tested by

no test coverage detected