Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-11-19 02:28:05 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2015-11-19 02:41:25 +0300
commit50ce510ac4e3ed093c051738242a9a75aeeb36ce (patch)
tree53a8d1c3886ce622a20c48768175b5ed6d4229ef /libavcodec/pthread_slice.c
parent047bf82c181c1220b3087b37f28445f8b87a7a23 (diff)
avcodec/pthread_slice: remove dummy_ret hack
This should avoid some tsan warnings Found-by: Chris Cunningham <chcunningham@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/pthread_slice.c')
-rw-r--r--libavcodec/pthread_slice.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/libavcodec/pthread_slice.c b/libavcodec/pthread_slice.c
index c8e69f0a9a..f2c05d8772 100644
--- a/libavcodec/pthread_slice.c
+++ b/libavcodec/pthread_slice.c
@@ -80,6 +80,7 @@ static void* attribute_align_arg worker(void *v)
pthread_mutex_lock(&c->current_job_lock);
self_id = c->current_job++;
for (;;){
+ int ret;
while (our_job >= c->job_count) {
if (c->current_job == thread_count + c->job_count)
pthread_cond_signal(&c->last_job_cond);
@@ -96,8 +97,10 @@ static void* attribute_align_arg worker(void *v)
}
pthread_mutex_unlock(&c->current_job_lock);
- c->rets[our_job%c->rets_count] = c->func ? c->func(avctx, (char*)c->args + our_job*c->job_size):
- c->func2(avctx, c->args, our_job, self_id);
+ ret = c->func ? c->func(avctx, (char*)c->args + our_job*c->job_size):
+ c->func2(avctx, c->args, our_job, self_id);
+ if (c->rets)
+ c->rets[our_job%c->rets_count] = ret;
pthread_mutex_lock(&c->current_job_lock);
our_job = c->current_job++;
@@ -146,7 +149,6 @@ static av_always_inline void thread_park_workers(SliceThreadContext *c, int thre
static int thread_execute(AVCodecContext *avctx, action_func* func, void *arg, int *ret, int job_count, int job_size)
{
SliceThreadContext *c = avctx->internal->thread_ctx;
- int dummy_ret;
if (!(avctx->active_thread_type&FF_THREAD_SLICE) || avctx->thread_count <= 1)
return avcodec_default_execute(avctx, func, arg, ret, job_count, job_size);
@@ -165,7 +167,7 @@ static int thread_execute(AVCodecContext *avctx, action_func* func, void *arg, i
c->rets = ret;
c->rets_count = job_count;
} else {
- c->rets = &dummy_ret;
+ c->rets = NULL;
c->rets_count = 1;
}
c->current_execute++;