From: Sebastian B. <sb...@us...> - 2013-12-24 09:13:58
|
Update of /cvsroot/simplemail/simplemail/gtk In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv30980/gtk Modified Files: subthreads.c Log Message: Added thread_call_function_sync_v() function. This is similar to thread_call_function_sync() but accepts the arguments as a va_list. Index: subthreads.c =================================================================== RCS file: /cvsroot/simplemail/simplemail/gtk/subthreads.c,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- subthreads.c 24 Dec 2013 09:13:40 -0000 1.36 +++ subthreads.c 24 Dec 2013 09:13:56 -0000 1.37 @@ -303,17 +303,13 @@ return 0; } -int thread_call_function_sync(thread_t thread, void *function, int argcount, ...) +static int thread_call_function_sync_v(thread_t thread, void *function, int argcount, va_list argptr) { struct thread_call_function_sync_data data; int i; - va_list argptr; - assert(argcount < THREAD_CALL_FUNCTION_SYNC_DATA_NUM_ARGS); - va_start(argptr,argcount); - data.function = (int (*)(void))function; data.argcount = argcount; data.sync_cond = g_cond_new(); @@ -325,8 +321,6 @@ for (i=0; i < argcount; i++) data.arg[i] = va_arg(argptr, void *); - va_end (argptr); - g_mutex_lock(data.sync_mutex); g_main_context_invoke(thread->context, thread_call_function_sync_entry, &data); @@ -337,6 +331,18 @@ return 0; } +int thread_call_function_sync(thread_t thread, void *function, int argcount, ...) +{ + int rc; + + va_list argptr; + + va_start(argptr,argcount); + rc = thread_call_function_sync_v(thread, function, argcount, argptr); + va_end(argptr); + return rc; +} + /***************************************************************************************/ /* FIXME: Note that if the args are not passed in a register, but e.g., on the stack this doesn't need to |