]> git.sesse.net Git - x264/blobdiff - common/threadpool.c
x86inc: Simplify AUTO_REP_RET
[x264] / common / threadpool.c
index 205b23bdf09b5313fc6813c49420085a12cf542e..de1ae5f5d857b8addc54126c634b70da70d75e9c 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * threadpool.c: thread pooling
  *****************************************************************************
- * Copyright (C) 2010 x264 project
+ * Copyright (C) 2010-2015 x264 project
  *
  * Authors: Steven Walters <kemuri9@gmail.com>
  *
@@ -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) );