Date: Sun, 07 Dec 2003 08:11:27 +1100 From: Peter Kostouros <kpeter@melbpc.org.au> To: threads@FreeBSD.ORG Subject: Re: pthread_mutex_trylock() should never block Message-ID: <3FD245FF.3040003@melbpc.org.au>
next in thread | raw e-mail | index | archive | help
Hi I have been tracking mozilla (cvs) that terminates when linked against libkse: basically a routine checks whether a mutex variable is locked with a call to pthread_mutex_trylock() before it attempts to unlock it with pthread_mutex_unlock(). The return value of pthread_mutex_trylock is checked against EBUSY and terminates the process if it is otherwise. In my particular scenario, pthread_mutex_trylock() returns EDEADLK: the pthread_mutex_trylock man page does not mention EDEADLK as an error code. When the application is linked against libc_r or libthr, pthread_mutex_trylock returns EBUSY in the scenario described above. I suppose my question is how do you safely (and quickly) check the state of a mutex variable? Note, I am running FreeBSD 5.2-BETA i386 with SCHED_ULE. -- Regards Peter As always the organisation disavows knowledge of this email
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3FD245FF.3040003>