This is the mail archive of the pthreads-win32@sources.redhat.com mailing list for the pthreas-win32 project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Pthreads-win32 keeps a POSIX thread struct in which it stores the handle returned by the original Win32 CreateThread(). The pointer to the POSIX struct is kept in TLS (TSD) so that other pthread library functions can refer to that struct.I'm writing my own (very lightweight) threading library for Windows and POSIX threads. There are reasons why I can't use pthreads-win32, but they aren't important here. I'm currently implementing a ThisThread() routine. With POSIX threads I simply call pthread_self(), but I'm stuck for Windows.
Originally I called GetCurrentThread(), but that returns a pseudo handle, so I call DuplicateHandle(), as this pthreads-win32 library uses.
However, DuplicateHandle() creates a new handle every time it is called, so I can't compare them. Basically
ThisThread() != ThisThread()
How does the pthreads-win32 library solve this problem?
Regards. Ross
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |