> From: Keith Packard <[email protected]> > Date: Thu, 10 Dec 2015 07:18:23 -0800 > > Mark Kettenis <[email protected]> writes: > > > Ugh. Exporting global variables as part of the ABI is generally not > > such a good idea. Perhaps it is better to use functions to acquire > > and release the input mutex instead? > > Yeah, it's not a performance sensitive operation, so hiding the globals > in a function is a good idea. I'll leave the stub versions as static > inline so I don't have to move them to the new file (inputthread.c) > later, just redefine them in the header file. > > > Also, using TLS (i.e. __thread variables) isn't portable. That > > mechanism certainly isn't supported by all platforms supported by > > Xorg. > > I can add some autoconf magic to autodetect whether this is supported > and disable threaded input where it isn't.
Is that really necessary? If I understand the code correctly, you're using the __thread variable just to implement a recursive mutex. There are ways to do that without using a per-thread counter, which would avoid using the non-portable __thread storage class. However, is there a reason why you didn't use the PTHREAD_MUTEX_RECURSIVE mtex type that is standardized by POSIX? _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
