Zero  0.1.0
Public Types | Public Member Functions | Public Attributes | List of all members
tls_tricks::tls_blob< T > Struct Template Reference

Wrapper for a type, used by TLS_STRUCT helper macro. More...

#include <tls.h>

Public Types

enum  { MAX_BYTES_NEEDED = sizeof(T) + sizeof(long) - 1, ARRAY_SIZE = MAX_BYTES_NEEDED / sizeof(long) }
 

Public Member Functions

void init ()
 
void fini ()
 
Tget ()
 Used by fini() and init() and directly by macros. More...
 

Public Attributes

long _reserved_space [ARRAY_SIZE]
 

Detailed Description

template<typename T>
struct tls_tricks::tls_blob< T >

Wrapper for a type, used by TLS_STRUCT helper macro.

All thread-local variables declared by TLS_STRUCT are actually just a bunch of bytes... until init() and fini() are called, that is. After that the tls_blob acts like a smart pointer.

Member Enumeration Documentation

§ anonymous enum

template<typename T>
anonymous enum
Enumerator
MAX_BYTES_NEEDED 
ARRAY_SIZE 

Member Function Documentation

§ fini()

template<typename T>
void tls_tricks::tls_blob< T >::fini ( )
inline

Call T's destructor

§ get()

template<typename T>
T* tls_tricks::tls_blob< T >::get ( )
inline

Used by fini() and init() and directly by macros.

§ init()

template<typename T>
void tls_tricks::tls_blob< T >::init ( )
inline

Placement new, using _reserved_space, to make the type T's constructor get called.

Member Data Documentation

§ _reserved_space

template<typename T>
long tls_tricks::tls_blob< T >::_reserved_space[ARRAY_SIZE]

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