[openssl-dev] [openssl-team] Discussion: design issue: async and -lpthread

Kurt Roeckx kurt at roeckx.be
Tue Nov 24 18:00:00 UTC 2015


On Tue, Nov 24, 2015 at 03:16:59PM +0000, Jonathan Larmour wrote:
> On 23/11/15 20:34, Matt Caswell wrote:
> > One other option we could pursue is to use the "__thread" syntax for
> > thread local variables and avoid the need for libpthread altogether. An
> > earlier version of the code did this. I have not found a way to reliably
> > detect at compile time the capability to do this and my understanding is
> > that this is a lot less portable.
> 
> Behind the scenes, if pthreads are available on an OS, then the compiler
> will probably just end up using pthread functions anyway, meaning there's
> no advantage over having just linked against libpthread.

__thread can be used in something that doesn't use threads.  It
gets put in a different section in the elf file (.tbss, .tdata).
But that still requires that things like the dynamic loader
support it.


Kurt



More information about the openssl-dev mailing list