libthr shared locks

Konstantin Belousov kostikbel at
Wed Dec 30 14:15:17 UTC 2015

On Tue, Dec 29, 2015 at 02:18:27PM -0500, Daniel Eischen wrote:
> Perhaps another option is doing all of what we said above
> and also use your suggestion of libthr2, but have both libthr
> and libthr2, where libthr2 is labeled experimental or something
> similar.  Have a WITH_LIBTHR2 build flag that conditionally
> inlines the pthread locks and enables (links w/-pthread) libthr2
> for FreeBSD base OS.  A note/comment for the WITH_LIBTHR2 flag
> states that all ports must also be recompiled to be on the
> safe side.  This allows one to switch back and forth, as long
> as any affected ports are also rebuilt.
> If we were to introduce this in a future 12-current, we might
> have the WITH_LIBTHR_FOO flag anyway, at least initially, so
> perhaps it wouldn't be extra work.

This is cheating, but I agree that this is quite plausible approach. I
think about also adding the __INLINE_PTHREAD_LOCKS preprocessor macro to
select inlined locks at the compilation time. In other words, the user
which wants to start experimenting with the stuff would do

	cc -o program ... -lpthread2

I may just do this after I finish with my patches.

More information about the freebsd-threads mailing list