Re: PR_GetThreadID() fails with SEGV

Wan-Teh Chang <[email protected]> Mon, 15 Jun 2009 08:17:39 -0700
Newsgroups gmane.comp.mozilla.devel.nspr
Message-ID <[email protected]>
On Sat, Jun 13, 2009 at 7:54 PM, Jon Leighton<[email protected]> wrote:
>
> Thanks Wan-Teh.  Is there a new NSPR function to replace PR_GetThreadID(),
> or should I just make due without?

You should make do without PR_GetThreadID().
The closest thing is PR_GetCurrentThread(), which
returns a pointer rather than an integer.

You can also easily write your own function that
returns the native thread ID.  You do need to make
a non-portable assumption that pthread_t is either
an integer or a pointer.  The POSIX threads standard
allows pthread_t to be a struct, but in practice it is
almost always an integer or a pointer.

Wan-Teh