From: Sebastian B. <sb...@us...> - 2013-12-24 09:14:38
|
Update of /cvsroot/simplemail/simplemail/gtk In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv31321/gtk Modified Files: subthreads.c Log Message: Implemented thread_call_parent_function_sync() in a proper/better way. Index: subthreads.c =================================================================== RCS file: /cvsroot/simplemail/simplemail/gtk/subthreads.c,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -r1.38 -r1.39 --- subthreads.c 24 Dec 2013 09:14:18 -0000 1.38 +++ subthreads.c 24 Dec 2013 09:14:35 -0000 1.39 @@ -571,22 +571,18 @@ int thread_call_parent_function_sync(int *success, void *function, int argcount, ...) { - struct ipc_message msg; + uintptr_t rc; + int s; + va_list argptr; va_start(argptr,argcount); - memset(&msg,0,sizeof(msg)); - msg.async = 0; - msg.function = function; - msg.argcount = argcount; - if (argcount--) msg.arg1 = va_arg(argptr, void *); - if (argcount--) msg.arg2 = va_arg(argptr, void *); - if (argcount--) msg.arg3 = va_arg(argptr, void *); - if (argcount--) msg.arg4 = va_arg(argptr, void *); - write(sockets[1],&msg,sizeof(msg)); + s = thread_call_function_sync_v(&main_thread, &rc, function, argcount, argptr); va_end(argptr); - read(sockets[1],&msg,sizeof(msg)); - return msg.rc; + if (success) + *success = s; + + return rc; } /***************************************************************************************/ |