diff options
author | Diego Biurrun <diego@biurrun.de> | 2005-12-22 01:10:11 +0000 |
---|---|---|
committer | Diego Biurrun <diego@biurrun.de> | 2005-12-22 01:10:11 +0000 |
commit | bb270c0896b39e1ae9277355e3c120ed3feb64a3 (patch) | |
tree | fc2fc2b1216d19acb3879abb6ea5a3b400f43fe4 /libavcodec/pthread.c | |
parent | 50827fcf44f34521df4708cdb633809b56fb9df3 (diff) | |
download | ffmpeg-streaming-bb270c0896b39e1ae9277355e3c120ed3feb64a3.zip ffmpeg-streaming-bb270c0896b39e1ae9277355e3c120ed3feb64a3.tar.gz |
COSMETICS: tabs --> spaces, some prettyprinting
Originally committed as revision 4764 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/pthread.c')
-rw-r--r-- | libavcodec/pthread.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c index 57bbfb2..e5cc29b 100644 --- a/libavcodec/pthread.c +++ b/libavcodec/pthread.c @@ -53,24 +53,24 @@ static void* worker(void *v) pthread_mutex_lock(&c->current_job_lock); self_id = c->current_job++; for (;;){ - while (our_job >= c->job_count) { - if (c->current_job == thread_count + c->job_count) - pthread_cond_signal(&c->last_job_cond); + while (our_job >= c->job_count) { + if (c->current_job == thread_count + c->job_count) + pthread_cond_signal(&c->last_job_cond); - pthread_cond_wait(&c->current_job_cond, &c->current_job_lock); + pthread_cond_wait(&c->current_job_cond, &c->current_job_lock); our_job = self_id; - if (c->done) { - pthread_mutex_unlock(&c->current_job_lock); - return NULL; - } - } - pthread_mutex_unlock(&c->current_job_lock); + if (c->done) { + pthread_mutex_unlock(&c->current_job_lock); + return NULL; + } + } + pthread_mutex_unlock(&c->current_job_lock); - c->rets[our_job%c->rets_count] = c->func(avctx, c->args[our_job]); + c->rets[our_job%c->rets_count] = c->func(avctx, c->args[our_job]); - pthread_mutex_lock(&c->current_job_lock); - our_job = c->current_job++; + pthread_mutex_lock(&c->current_job_lock); + our_job = c->current_job++; } } @@ -116,10 +116,10 @@ int avcodec_thread_execute(AVCodecContext *avctx, action_t* func, void **arg, in c->func = func; if (ret) { c->rets = ret; - c->rets_count = job_count; + c->rets_count = job_count; } else { c->rets = &dummy_ret; - c->rets_count = 1; + c->rets_count = 1; } pthread_cond_broadcast(&c->current_job_cond); @@ -154,8 +154,8 @@ int avcodec_thread_init(AVCodecContext *avctx, int thread_count) pthread_mutex_lock(&c->current_job_lock); for (i=0; i<thread_count; i++) { if(pthread_create(&c->workers[i], NULL, worker, avctx)) { - avctx->thread_count = i; - pthread_mutex_unlock(&c->current_job_lock); + avctx->thread_count = i; + pthread_mutex_unlock(&c->current_job_lock); avcodec_thread_free(avctx); return -1; } |