CrystalSpace

Public API Reference

CS::Threading::ThreadLocalBase Class Reference

Thread local storage of a pointer value (void*). More...

#include <csutil/threading/tls.h>

Inheritance diagram for CS::Threading::ThreadLocalBase:

List of all members.

Public Types

typedef void(* DestructorFn )(void *)
 TLS value destructor function.

Public Member Functions

void * GetValue () const
 Get the TLS slot value for the current thread. Defaults to 0.
void SetValue (void *data) const
 Set the TLS slot value for the current thread.
 ThreadLocalBase (DestructorFn dtor=0)
 Create a TLS slot with the given destructor function.
 ~ThreadLocalBase ()
 Delete the TLS slot.

Detailed Description

Thread local storage of a pointer value (void*).

Wraps the platform-specific TLS details.

Optionally, a "destructor" function can be specified which is called when the thread exists and the TLS value for the thread is not null. Note it's called only on thread exit, not when the TLS slot itself is destroyed! (Essentially, the same as pthreads behaves.)

Warning:
Proper destructor function support is only guaranteed if CS' Thread facility is used.

Definition at line 58 of file tls.h.


Member Typedef Documentation

TLS value destructor function.

Definition at line 62 of file tls.h.


Constructor & Destructor Documentation

CS::Threading::ThreadLocalBase::ThreadLocalBase ( DestructorFn  dtor = 0  ) 

Create a TLS slot with the given destructor function.

CS::Threading::ThreadLocalBase::~ThreadLocalBase (  ) 

Delete the TLS slot.


Member Function Documentation

void* CS::Threading::ThreadLocalBase::GetValue (  )  const

Get the TLS slot value for the current thread. Defaults to 0.

void CS::Threading::ThreadLocalBase::SetValue ( void *  data  )  const

Set the TLS slot value for the current thread.


The documentation for this class was generated from the following file:

Generated for Crystal Space 2.1 by doxygen 1.6.1