[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Global state (was: I am back)

From: Werner Koch
Subject: Global state (was: I am back)
Date: Tue, 16 May 2000 11:30:17 +0200
User-agent: Mutt/1.1.8i

On Tue, 16 May 2000, Nikos Mavroyanopoulos wrote:

> Since we have a global state, all these functions do use the global
> variables to determine what to send. Eg gnutls_send_hello() does not require
> any parameters, and will determine from the state an from the available

Although I have not lloked at the code for a while, I have one suggestion:
Do not use global variables, but pass a handle to a structure which
actually is a pointer to an allocated structure carrying the "global"
state.  This greatly helps to make the lib reentrant.

You either need an extra function to create a handle or you imlicitly
create the handle by assuming that a handle pointing to NULL has to 
be initialized - however, you need a function to release the handle
anyway (using reference counting is somewhat complicated) and
therefore 2 functions would be better.


Werner Koch                             OpenPGP key 621CC013
OpenIT GmbH                             tel +49 211 239577-0
Birkenstr. 12                           email   address@hidden
D-40233 Duesseldorf           

reply via email to

[Prev in Thread] Current Thread [Next in Thread]