Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Feb 2004 17:02:48 +0100
From:      des@des.no (Dag-Erling =?iso-8859-1?q?Sm=F8rgrav?=)
To:        Daniel Eischen <eischen@vigrid.com>
Cc:        threads@freebsd.org
Subject:   Re: cross-thread locking
Message-ID:  <xzpn07dspqv.fsf@dwp.des.no>
In-Reply-To: <Pine.GSO.4.10.10402200935470.23368-100000@pcnet5.pcnet.com> (Daniel Eischen's message of "Fri, 20 Feb 2004 10:02:01 -0500 (EST)")
References:  <Pine.GSO.4.10.10402200935470.23368-100000@pcnet5.pcnet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Daniel Eischen <eischen@vigrid.com> writes:
> POSIX differentiates between spinlocks and mutexes, and that is
> why there is a pthread_spinlock_t instead of using pthread_mutex_t
> for both lock operations.  I believe the implementation is allowed
> to spin indefinitely or schedule another thread if the lock is
> busy.

In other words, the semantics for the two are identical?

BTW, I looked at the libpthread sources, and it seems to me that a
spinlock is just a wrapper around a mutex, though the comments
contradict this.

Going off on a tangent, is there a value one can assign to a pthread_t
to make it unambiguously invalid?  Obviously, NULL or 0 will work in
FreeBSD since our pthread_t is a pointer to a struct pthread, but I'm
looking for something more portable.

DES
--=20
Dag-Erling Sm=F8rgrav - des@des.no



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