making gnutls depended to pthread

Simon Josefsson simon at
Tue Jun 29 11:36:16 CEST 2010

Nikos Mavrogiannopoulos <nmav at> writes:

> Hello,
>  I've been thinking it for quite some time but given the bug report:
> , I think it might be relevant.
> GnuTLS due to its use of random numbers will always need a global pool
> to be accessed, and thus locking is mandatory. How about making a new
> gnutls_global_init2() that accept flags such as USE_SYSTEM_LOCKS (that
> would be pthread for linux), by default? This way gnutls will initialize
> all libraries that it is depended on using the default threads for each
> system.

I don't want to see GnuTLS require pthreads, as pthreads doesn't exist
on several platforms (e.g., Windows).

Even on GNU/Linux I'm not sure pthreads is universal, I think both GNU
Pth and NPTL is still in wide use.

So I think a flag USE_SYSTEM_LOCKS flag would be confusing, as it isn't
clear what the application is getting -- one library may be using the
system's NPTL library and another library may be using the system
-lpthread and a third library may use GNU Pth, and if the all are linked
into one application, things will break badly.

Doesn't a gnutls_global_set_mutex-approach where the caller provides the
mutex functions solve this problem?


More information about the Gnutls-devel mailing list