[gnutls-devel] [TLS] multiple clients in one process (was: Re: Deployment ... Re: This working group has failed)

Nikos Mavrogiannopoulos nmav at gnutls.org
Sun Dec 1 11:00:23 CET 2013


On Sat, 2013-11-30 at 20:07 -0600, Nico Williams wrote:

> Again, the canonical example is something like PAM, or the name
> service switch -- plugin interfaces where more than one plugin might
> want to use your utility library: a TLS library in this case, and TLS
> being as ubiquitous as it is, this example does in fact come up.  This
> is an aspect of DLL Hell.  You can make DLL Hell less painful by
> removing the race to initialize, either by making it safe to race to
> initialize, or by removing the need to initialize.  Since you can
> remove the need to initialize (on every modern OS, on every modern
> architecture), and since that simplifies your API *and* your docs,
> that's clearly the way to go.
> 
> > Indeed, I can fix the unsafe part with static initializers, and I'll try
> > to, but that will not fix the waste of resources.
> What waste of resources?

Like calling an initialization function on each and every thread. An
initialization function does much more than setting up mutexes, such as
precalculate values etc. A lock added there for thread safety cannot
protect from running this function multiple times needlessly. Think of a
case where threads are run serialized, and call global_init() and
global_deinit(). They will all have to run the initialization routine.

regards,
Nikos





More information about the Gnutls-devel mailing list