[PATCH xserver 4/8] Create a threaded mechanism for input [v3]
Mark Kettenis
mark.kettenis at xs4all.nl
Sat Dec 12 05:53:19 PST 2015
> From: Keith Packard <keithp at keithp.com>
> Date: Fri, 11 Dec 2015 15:37:24 -0800
>
> Keith Packard <keithp at keithp.com> writes:
>
> > Mark Kettenis <mark.kettenis at xs4all.nl> writes:
> >
> >> However, is there a reason why you didn't use the
> >> PTHREAD_MUTEX_RECURSIVE mtex type that is standardized by POSIX?
> >
> > Sorry, my documentation only mentions a non-portable version of
> > recursive mutexes. I didn't even know that recursive mutexes had been
> > standardized. Looks like we've got options.
>
> So, how about this preference plan, picking the first one which works:
>
> 1) PTHREAD_MUTEX_RECURSIVE
> 2) PTHREAD_MUTEX_RECURSIVE_NP
> 3) PTHREAD_MUTEX_NORMAL + __thread variable
> 4) PTHREAD_MUTEX_NORMAL + thread specific variables
I'd say that would be overkill. The use of recursive mutexes is
somewhat controversal, which is almost certainly why they weren't part
of POSIX initially. But they were part of Unix98 and present as an
XSI extension in POSIX until they were moved to base in 2008.
So unless there is real evidence that there are still supported
systems out there that don't provide PTHREAD_MUTEX_RECURSIVE, I'd stop
at 1) and disable the input thread support on systems that don't
provide it. Adding fallbacks just increases the maintenance burden.
Must admit that I have an agenda here. I'd like to avoid 3) as this
might encourage people to use __thread in other places in the Xorg
codebase.
More information about the xorg-devel
mailing list