X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=common%2Fthreadpool.c;h=de1ae5f5d857b8addc54126c634b70da70d75e9c;hb=5c3d473a966e4b013759097fb98cd4a9cb5a34f5;hp=a1e5c95a3755b134d63a137b16f33df652ceac02;hpb=ee9bc136e9e6f0875308c9505a08360294e7cd4a;p=x264 diff --git a/common/threadpool.c b/common/threadpool.c index a1e5c95a..de1ae5f5 100644 --- a/common/threadpool.c +++ b/common/threadpool.c @@ -1,7 +1,7 @@ /***************************************************************************** * threadpool.c: thread pooling ***************************************************************************** - * Copyright (C) 2010-2011 x264 project + * Copyright (C) 2010-2015 x264 project * * Authors: Steven Walters * @@ -47,7 +47,7 @@ struct x264_threadpool_t x264_sync_frame_list_t done; /* list of jobs that have finished processing */ }; -static void x264_threadpool_thread( x264_threadpool_t *pool ) +static void *x264_threadpool_thread( x264_threadpool_t *pool ) { if( pool->init_func ) pool->init_func( pool->init_arg ); @@ -66,9 +66,10 @@ static void x264_threadpool_thread( x264_threadpool_t *pool ) x264_pthread_mutex_unlock( &pool->run.mutex ); if( !job ) continue; - job->ret = job->func( job->arg ); /* execute the function */ + job->ret = (void*)x264_stack_align( job->func, job->arg ); /* execute the function */ x264_sync_frame_list_push( &pool->done, (void*)job ); } + return NULL; } int x264_threadpool_init( x264_threadpool_t **p_pool, int threads, @@ -83,7 +84,7 @@ int x264_threadpool_init( x264_threadpool_t **p_pool, int threads, pool->init_func = init_func; pool->init_arg = init_arg; - pool->threads = X264_MIN( threads, X264_THREAD_MAX ); + pool->threads = threads; CHECKED_MALLOC( pool->thread_handle, pool->threads * sizeof(x264_pthread_t) );