From b1dc8324d03053ffb427424c8de046863757d8ec Mon Sep 17 00:00:00 2001 From: rpj Date: Sat, 26 May 2007 14:57:19 +0000 Subject: Added pthread_getw32threadid_np function untested --- README.NONPORTABLE | 10 ++++++++++ pthread.h | 4 ++++ pthread_getw32threadhandle_np.c | 12 ++++++++++++ 3 files changed, 26 insertions(+) diff --git a/README.NONPORTABLE b/README.NONPORTABLE index e138758..192fef6 100644 --- a/README.NONPORTABLE +++ b/README.NONPORTABLE @@ -72,6 +72,16 @@ pthread_getw32threadhandle_np(pthread_t thread); Applications can use the win32 handle to set win32 specific attributes of the thread. +DWORD +pthread_getw32threadid_np (pthread_t thread) + + Returns the win32 thread ID that the POSIX + thread "thread" is running as. + + Only valid when the library is built where + ! defined (__MINGW32__) || defined (__MSVCRT__) || defined (__DMC__) + and otherwise returns 0. + int pthread_mutexattr_setkind_np(pthread_mutexattr_t * attr, int kind) diff --git a/pthread.h b/pthread.h index 1fd465b..9026111 100644 --- a/pthread.h +++ b/pthread.h @@ -1184,6 +1184,10 @@ PTW32_DLLPORT void * PTW32_CDECL pthread_timechange_handler_np(void *); * Returns the Win32 HANDLE for the POSIX thread. */ PTW32_DLLPORT HANDLE PTW32_CDECL pthread_getw32threadhandle_np(pthread_t thread); +/* + * Returns the win32 thread ID for POSIX thread. + */ +PTW32_DLLPORT DWORD PTW32_CDECL pthread_getw32threadid_np (pthread_t thread); /* diff --git a/pthread_getw32threadhandle_np.c b/pthread_getw32threadhandle_np.c index 9d22def..309a8f2 100644 --- a/pthread_getw32threadhandle_np.c +++ b/pthread_getw32threadhandle_np.c @@ -51,3 +51,15 @@ pthread_getw32threadhandle_np (pthread_t thread) { return ((ptw32_thread_t *)thread.p)->threadH; } + +/* + * pthread_getw32threadid_np() + * + * Returns the win32 thread id that the POSIX + * thread "thread" is running as. + */ +DWORD +pthread_getw32threadid_np (pthread_t thread) +{ + return ((ptw32_thread_t *)thread.p)->thread; +} -- cgit v1.2.3