diff options
author | jsorg71 <jsorg71> | 2005-06-28 03:04:36 +0000 |
---|---|---|
committer | jsorg71 <jsorg71> | 2005-06-28 03:04:36 +0000 |
commit | 41df89c7f2da57650948967a78afa352a3dfc4b6 (patch) | |
tree | 1c7b4c36287fe3ab3a212a3808f76fbfe895b09a /common/thread_calls.c | |
parent | fd4beef2df71d8c44e8de47a476f319d1d49a038 (diff) | |
download | xrdp-proprietary-41df89c7f2da57650948967a78afa352a3dfc4b6.tar.gz xrdp-proprietary-41df89c7f2da57650948967a78afa352a3dfc4b6.zip |
moved some files around
Diffstat (limited to 'common/thread_calls.c')
-rw-r--r-- | common/thread_calls.c | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/common/thread_calls.c b/common/thread_calls.c new file mode 100644 index 00000000..ad2334d4 --- /dev/null +++ b/common/thread_calls.c @@ -0,0 +1,60 @@ +/* + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + xrdp: A Remote Desktop Protocol server. + Copyright (C) Jay Sorg 2004-2005 + + thread calls + +*/ + +#if defined(_WIN32) +#include <windows.h> +#else +#include <pthread.h> +#endif + +/*****************************************************************************/ +#if defined(_WIN32) +int +g_thread_create(unsigned long (__stdcall * start_routine)(void*), void* arg) +{ + DWORD thread; + + return !CreateThread(0, 0, start_routine, arg, 0, &thread); +} +#else +int +g_thread_create(void* (* start_routine)(void*), void* arg) +{ + pthread_t thread; + int rv; + + rv = pthread_create(&thread, 0, start_routine, arg); + pthread_detach(thread); + return rv; +} +#endif + +/*****************************************************************************/ +int +g_get_threadid(void) +{ +#if defined(_WIN32) + return 0; +#else + return pthread_self(); +#endif +} |