[Xcb] More pthread stubs.
Rémi Denis-Courmont
remi at remlab.net
Wed Mar 10 11:27:04 PST 2010
Le mercredi 10 mars 2010 21:11:56 M Joonas Pihlaja, vous avez écrit :
> Personally I'm not a huge fan of providing checking since we'd need to
> actually save some state somewhere, and also we'd need to make some
> assumptions about the system's static mutex initializers. While
> pthreads itself only supports PTHREAD_MUTEX_INITIALIZER, apps use
> non-portable initializers like PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP.
> I suppose we could autoconf our way out of this though. *sigh*
Error-checking means error-checking though. If an application selects to use
an error-checking mutex, it probably relies on the error semantics. Even if it
is for pure debugging purpose, it is not safe to return zero. I have myself
written such "horrors" as
#define foo_assert_locked(lock) assert(pthread_mutex_lock(lock) == EDEADLK);
which are perfectly valid code. Your patch would break that code.
It could even be for more serious functionality, e.g. detecting transactional
deadlocks. Otherwise, the application might as well use a fast mutex.
--
Rémi Denis-Courmont
http://www.remlab.net/
http://fi.linkedin.com/in/remidenis
More information about the Xcb
mailing list