Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Jul 2003 03:24:54 -0700
From:      Terry Lambert <tlambert2@mindspring.com>
To:        Brooks Davis <brooks@one-eyed-alien.net>
Cc:        freebsd-threads@freebsd.org
Subject:   Re: null pthread_t
Message-ID:  <3F0D3EF6.A9000297@mindspring.com>
References:  <20030710001744.GA7135@Odin.AC.HMC.Edu>

next in thread | previous in thread | raw e-mail | index | archive | help
Brooks Davis wrote:
> Since FreeBSD uses pointers instead of integers for pthread_t's, this
> generates warnings which go away if you replace -1 with NULL, but
> it seems like that is likely to do bad things on linux.  Is there a
> portable NULL-equivalent pthread_t?  I'm not seeing anything jump out at
> me in the headers.

pthread_t PTHREAD_NULL;	/* global NULL equivalent */

pthread_t ptr;


	...

	if( ptr == PTHREAD_NULL)

Basically, the type will be a BSS zero'ed global "NULL" in both
compilation environments, and the comparison will "just work"
because the type will be right.

-- Terry



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3F0D3EF6.A9000297>