Doesn't actually affect x264, but it's more correct.
return 0;
}
#define x264_pthread_join(t,s) { long tmp; \
- wait_for_thread(t,(s)?(long*)(*(s)):&tmp); }
+ wait_for_thread(t,(s)?(long*)(s):&tmp); }
#elif HAVE_POSIXTHREAD
#include <pthread.h>
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 );
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,
static unsigned __stdcall x264_win32thread_worker( void *arg )
{
x264_pthread_t *h = arg;
- h->ret = h->func( h->arg );
+ *h->p_ret = h->func( h->arg );
return 0;
}
{
thread->func = start_routine;
thread->arg = arg;
+ thread->p_ret = &thread->ret;
+ thread->ret = NULL;
thread->handle = (void*)_beginthreadex( NULL, 0, x264_win32thread_worker, thread, 0, NULL );
return !thread->handle;
}
if( ret != WAIT_OBJECT_0 )
return -1;
if( value_ptr )
- *value_ptr = thread.ret;
+ *value_ptr = *thread.p_ret;
CloseHandle( thread.handle );
return 0;
}
void *handle;
void *(*func)( void* arg );
void *arg;
+ void **p_ret;
void *ret;
} x264_pthread_t;
#define x264_pthread_attr_t int
x264_pthread_mutex_unlock( &h->lookahead->ofbuf.mutex );
}
-static void x264_lookahead_thread( x264_t *h )
+static void *x264_lookahead_thread( x264_t *h )
{
int shift;
#if HAVE_MMX
h->lookahead->b_thread_active = 0;
x264_pthread_cond_broadcast( &h->lookahead->ofbuf.cv_fill );
x264_pthread_mutex_unlock( &h->lookahead->ofbuf.mutex );
+ return NULL;
}
#endif