libthr shared locks

Daniel Eischen deischen at
Wed Dec 23 19:48:59 UTC 2015

On Wed, 23 Dec 2015, Konstantin Belousov wrote:

> On Wed, Dec 23, 2015 at 01:27:35PM -0500, Daniel Eischen wrote:
>> On Wed, 23 Dec 2015, Konstantin Belousov wrote:
>> [ ... ]
>>> Would the ABI modified to make the pthread_mutex_t large enough to
>>> hold struct pthread_mutex, the rest of the implementation of the
>>> shared mutex is relatively trivial, if not already done.
>>> Changing this ABI is very hard.  libthr provides the symbol
>>> versioning, which allows to provide compatible shims for the previous
>>> ABI variant.  But since userspace tends to use the pthread objects in
>>> the layouts of the library objects, this causes serious ABI issues
>>> when mixing libraries built against different default versions of
>>> libthr.
>> I think this is only if the libraries (or apps) pass pthread
>> lock types between them, that one has initialized with one ABI
>> but the other library uses another ABI.  We should really
>> exclude this as part of our ABI compatibility.
> Applications commonly embed pthread locks into their objects, including
> the exposed ABI in the third-party libraries.
> struct my_object {
> 	pthread_mutex_t obj_lock;
> 	...
> };
> Changing the size of the pthread locks causes uncontrolled breakage of
> the ABI for significant number of third-party code.

If the application creates the object itself or allocates storage
for it, basically, if it isn't opaque, yes.  But we can bump port
revisions for affected libraries (probably just searching
/usr/local/include/... for pthread_mutex, pthread_cond, etc
types to see possible problems.  I did a search for the installed
ports on my system and found a few that might cause problems.

I think we're just putting off the inevitable.  Do we not want
to change our pthread sync types anyway, to get rid of an extra
dereference per lock?  To get rid of the hacks in libc, rtld,

If the answer is no, we never want to do that, then ok.


More information about the freebsd-arch mailing list