X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=lib%2Fsilcutil%2Fwin32%2Fsilcwin32thread.c;h=6e6a90949521ab204206cdc7cd3a2a184f266fc1;hb=99865727f85eb96f5462158eed8dc935710d1a0b;hp=e88a09f0c4690bbfdf9f7cddad507ef43d6d79cb;hpb=e4b63806b89601e4e787c239b39b1bee33e46f7e;p=silc.git diff --git a/lib/silcutil/win32/silcwin32thread.c b/lib/silcutil/win32/silcwin32thread.c index e88a09f0..6e6a9094 100644 --- a/lib/silcutil/win32/silcwin32thread.c +++ b/lib/silcutil/win32/silcwin32thread.c @@ -49,10 +49,12 @@ unsigned __stdcall silc_thread_win32_start(void *context) return 0; } +#endif SilcThread silc_thread_create(SilcThreadStart start_func, void *context, bool waitable) { +#ifdef SILC_THREADS SilcWin32Thread thread; unsigned id; @@ -71,10 +73,16 @@ SilcThread silc_thread_create(SilcThreadStart start_func, void *context, } return (SilcThread)thread; +#else + /* Call thread callback immediately */ + (*start_func)(context); + return NULL; +#endif } void silc_thread_exit(void *exit_value) { +#ifdef SILC_THREADS SilcWin32Thread thread = TlsGetValue(silc_thread_tls); if (thread) { @@ -89,10 +97,12 @@ void silc_thread_exit(void *exit_value) } _endthreadex(0); +#endif } SilcThread silc_thread_self(void) { +#ifdef SILC_THREADS SilcWin32Thread self = TlsGetValue(silc_thread_tls); if (!self) { @@ -107,10 +117,14 @@ SilcThread silc_thread_self(void) } return (SilcThread)self; +#else + return NULL; +#endif } bool silc_thread_wait(SilcThread thread, void **exit_value) { +#ifdef SILC_THREADS SilcWin32Thread self = (SilcWin32Thread)thread; SILC_LOG_DEBUG(("Waiting for thread %p", self)); @@ -127,6 +141,7 @@ bool silc_thread_wait(SilcThread thread, void **exit_value) *exit_value = NULL; return TRUE; +#else + return FALSE; +#endif } - -#endif /* SILC_THREADS */