[Xcb] More pthread stubs.

Rémi Denis-Courmont remi at remlab.net
Wed Mar 10 03:20:20 PST 2010


On Thu, 4 Mar 2010 11:39:57 +0200 (EET), M Joonas Pihlaja
<jpihlaja at cc.helsinki.fi> wrote:
> Recently cairo started using recursive mutexes and we found that both
> pthread-stubs and glibc are missing stubs for creating and setting
> mutex attributes.  We moved to directly linking to pthreads then but
> doing it correctly is such a can of worms that it's just easier to add
> the stubs which we use.  While doing that I've fleshed out some of the
> other (hopefully uncontroversial) missing stubs while trying to stay
> within the boundaries described by Jamey Sharp in a post last fall[1]
> (No getters. Only setters, attributes, and noop-locks.)

In principle, the attribute setters should check that the value is valid
and return EINVAL if not. In that perspective, at least
pthread_condattr_setclock() and pthread_mutexattr_settype() shouldn't
blindly return zero. I have not checked the other ones.

Also pthread_mutex_lock() should probably to check against recursive
locking if you add pthread_mutexattr_settype(), meaning you add
error-checking mutexes.

-- 
Rémi Denis-Courmont
http://www.remlab.net
http://fi.linkedin.com/in/remidenis



More information about the Xcb mailing list