COSMETICS: tabs --> spaces, some prettyprinting
Originally committed as revision 4764 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
		@@ -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;
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user