[gnutls-dev] Re: living without global variables
Bryan Henderson
bryanh at giraffe-data.com
Mon Dec 26 19:35:30 CET 2005
>This is a one time call initialization function, so it is
>perfectly ok to leave the thread stuff to the called application.
The reason it's not _perfectly_ OK is what I started this whole
discussion with: lack of modularity. The calling code may be a module
of a larger program. That larger program may contain another module
which also uses GnuTLS. The two modules run in their own threads. As
modules, they don't know about each other and cannot coordinate their
calls to gnutls_global_init(). Modularity also forbids the code which
is the parent of the threads/modules from knowing that GNUtls is down
inside those modules, so the parent code can't call
gnutls_global_init() either.
It's _reasonable_ to produce a GnuTLS that has a nonthreadsafe
gnutls_global_init() and not threadsafe alternative -- it just means the
library isn't all it could be.
--
Bryan Henderson Phone 408-621-2000
San Jose, California
More information about the Gnutls-devel
mailing list