tls.c File Reference

#include "thread.h"

Functions

void Ns_TlsAlloc (Ns_Tls *keyPtr, Ns_TlsCleanup *cleanup)
void Ns_TlsSet (Ns_Tls *keyPtr, void *value)
void * Ns_TlsGet (Ns_Tls *keyPtr)
void NsCleanupTls (void **slots)

Variables

int nsThreadMaxTls = NS_THREAD_MAXTLS

Function Documentation

void Ns_TlsAlloc ( Ns_Tls *  keyPtr,
Ns_TlsCleanup *  cleanup 
)

----------------------------------------------------------------------

Ns_TlsAlloc --

Allocate the next tls id.

Results: None.

Side effects: Id is set in given tlsPtr.

----------------------------------------------------------------------

void* Ns_TlsGet ( Ns_Tls *  keyPtr  ) 

----------------------------------------------------------------------

Ns_TlsGet --

Get this thread's value in a tls slot.

Results: Pointer in slot.

Side effects: None.

----------------------------------------------------------------------

void Ns_TlsSet ( Ns_Tls *  keyPtr,
void *  value 
)

----------------------------------------------------------------------

Ns_TlsSet --

Set the value for a threads tls slot.

Results: None.

Side effects: None.

----------------------------------------------------------------------

void NsCleanupTls ( void **  slots  ) 

----------------------------------------------------------------------

NsCleanupTls --

Cleanup thread local storage in LIFO order for an exiting thread. Note the careful use of the counters to keep iterating over the list, up to 5 times, until all TLS values are NULL. This emulates the Pthread TLS behavior which catches a destructor inadvertantly calling a library which resets a TLS value after it's been destroyed.

Results: None.

Side effects: Cleanup procs are invoked for non-null values.

----------------------------------------------------------------------


Variable Documentation

int nsThreadMaxTls = NS_THREAD_MAXTLS

The following global variable specifies the maximum TLS id. Modifying this value has no effect.


Generated on Tue Sep 4 19:58:57 2007 by  doxygen 1.5.1