summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsorg71 <jsorg71>2006-09-23 01:57:16 +0000
committerjsorg71 <jsorg71>2006-09-23 01:57:16 +0000
commite0d2711c907d92c5827767747457f830ac5d70cc (patch)
tree6afa2345b59ecb07c680d557f8ce446b4dce2feb
parentde8343eca5e37848b58e5e5b77b3d94ebbf929eb (diff)
downloadxrdp-proprietary-e0d2711c907d92c5827767747457f830ac5d70cc.tar.gz
xrdp-proprietary-e0d2711c907d92c5827767747457f830ac5d70cc.zip
win32 thread creation fix
-rw-r--r--common/thread_calls.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/common/thread_calls.c b/common/thread_calls.c
index 578bc0b9..c895a5d5 100644
--- a/common/thread_calls.c
+++ b/common/thread_calls.c
@@ -28,13 +28,20 @@
#include "arch.h"
/*****************************************************************************/
+/* returns error */
#if defined(_WIN32)
int APP_CC
g_thread_create(unsigned long (__stdcall * start_routine)(void*), void* arg)
{
- DWORD thread;
+ DWORD thread_id;
+ HANDLE thread;
+ int rv;
- return !CreateThread(0, 0, start_routine, arg, 0, &thread);
+ /* CreateThread returns handle or zero on error */
+ thread = CreateThread(0, 0, start_routine, arg, 0, &thread_id);
+ rv = !thread;
+ CloseHandle(thread);
+ return rv;
}
#else
int APP_CC
@@ -43,6 +50,7 @@ g_thread_create(void* (* start_routine)(void*), void* arg)
pthread_t thread;
int rv;
+ /* pthread_create returns error */
rv = pthread_create(&thread, 0, start_routine, arg);
pthread_detach(thread);
return rv;