From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31209 invoked by alias); 31 Aug 2003 17:52:28 -0000 Mailing-List: contact pthreads-win32-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: pthreads-win32-owner@sources.redhat.com Received: (qmail 31202 invoked from network); 31 Aug 2003 17:52:28 -0000 Received: from unknown (HELO moutng.kundenserver.de) (212.227.126.177) by sources.redhat.com with SMTP; 31 Aug 2003 17:52:28 -0000 Received: from [212.227.126.205] (helo=mrelayng.kundenserver.de) by moutng.kundenserver.de with esmtp (Exim 3.35 #1) id 19tWNI-0007o0-00 for pthreads-win32@sources.redhat.com; Sun, 31 Aug 2003 19:52:28 +0200 Received: from [81.128.41.74] (helo=william) by mrelayng.kundenserver.de with asmtp (Exim 3.35 #1) id 19tWNH-0005ki-00 for pthreads-win32@sources.redhat.com; Sun, 31 Aug 2003 19:52:28 +0200 Subject: How is pthread_self() implemented? From: Chris Seaton To: pthreads-win32@sources.redhat.com Content-Type: text/plain Message-Id: <1062352346.4373.7.camel@william> Mime-Version: 1.0 Date: Sun, 31 Aug 2003 17:52:00 -0000 Content-Transfer-Encoding: 7bit X-SW-Source: 2003/txt/msg00082.txt.bz2 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/