public inbox for pthreads-win32@sourceware.org
 help / color / mirror / Atom feed
* How is pthread_self() implemented?
@ 2003-08-31 17:52 Chris Seaton
  2003-09-01  4:33 ` Ross Johnson
  0 siblings, 1 reply; 5+ messages in thread
From: Chris Seaton @ 2003-08-31 17:52 UTC (permalink / raw)
  To: pthreads-win32

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?
-- 
Chris Seaton

chris@chrisseaton.com
http://www.chrisseaton.com/

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-09-01 15:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-31 17:52 How is pthread_self() implemented? Chris Seaton
2003-09-01  4:33 ` Ross Johnson
2003-09-01  4:41   ` Will Bryant
2003-09-01  7:22     ` Ross Johnson
2003-09-01 15:49       ` Ross Johnson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).