Mercurial > libavcodec.hg
diff pthread.c @ 2979:bfabfdf9ce55 libavcodec
COSMETICS: tabs --> spaces, some prettyprinting
author | diego |
---|---|
date | Thu, 22 Dec 2005 01:10:11 +0000 |
parents | ef2149182f1c |
children | 0b546eab515d |
line wrap: on
line diff
--- a/pthread.c Wed Dec 21 17:50:40 2005 +0000 +++ b/pthread.c Thu Dec 22 01:10:11 2005 +0000 @@ -53,24 +53,24 @@ 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 @@ 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 @@ 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; }