Nebula
Loading...
Searching...
No Matches
OSX::OSXThreadLocalPtr< TYPE > Class Template Reference

#include <osxthreadlocalptr.h>

Detailed Description

template<typename TYPE>
class OSX::OSXThreadLocalPtr< TYPE >

GCC doesn't implement the __thread modifier on OSX.

Instead we use pthread keys to emulate the behaviour.

Todo
: Performance? Would it actually be better to allocate one pointer lookup-table and associate this with a single thread-local key as like on the Wii? At the moment every Ptr has its own key.
Todo
: If this object will be used for anything else then singleton, it might make sense to change the interface to look like a normal C-pointer.

(C) 2010 Radon Labs GmbH (C) 2013-2018 Individual contributors, see AUTHORS file

Instead we use pthread keys to emulate the behaviour.

Todo
: Performance? Would it actually be better to allocate one pointer lookup-table and associate this with a single thread-local key as like on the Wii? At the moment every Ptr has its own key.
Todo
: If this object will be used for anything else then singleton, it might make sense to change the interface to look like a normal C-pointer.

(C) 2010 Radon Labs GmbH (C) 2013-2018 Individual contributors, see AUTHORS file

Public Member Functions

 OSXThreadLocalPtr ()
 default constructor
 
 ~OSXThreadLocalPtr ()
 destructor
 
void set (TYPE *p)
 set content
 
TYPE * get () const
 get content
 
bool isvalid () const
 test if content is valid
 
 OSXThreadLocalPtr ()
 default constructor
 
 ~OSXThreadLocalPtr ()
 destructor
 
void set (TYPE *p)
 set content
 
TYPE * get () const
 get content
 
bool isvalid () const
 test if content is valid
 

Private Attributes

pthread_key_t key
 

Constructor & Destructor Documentation

◆ OSXThreadLocalPtr() [1/2]

template<typename TYPE >
OSX::OSXThreadLocalPtr< TYPE >::OSXThreadLocalPtr ( )

default constructor

◆ ~OSXThreadLocalPtr() [1/2]

template<typename TYPE >
OSX::OSXThreadLocalPtr< TYPE >::~OSXThreadLocalPtr ( )

destructor

◆ OSXThreadLocalPtr() [2/2]

template<typename TYPE >
OSX::OSXThreadLocalPtr< TYPE >::OSXThreadLocalPtr ( )

default constructor

◆ ~OSXThreadLocalPtr() [2/2]

template<typename TYPE >
OSX::OSXThreadLocalPtr< TYPE >::~OSXThreadLocalPtr ( )

destructor

Member Function Documentation

◆ get() [1/2]

template<typename TYPE >
TYPE * OSX::OSXThreadLocalPtr< TYPE >::get ( ) const

get content

◆ get() [2/2]

template<typename TYPE >
TYPE * OSX::OSXThreadLocalPtr< TYPE >::get ( ) const

get content

◆ isvalid() [1/2]

template<typename TYPE >
bool OSX::OSXThreadLocalPtr< TYPE >::isvalid ( ) const

test if content is valid

◆ isvalid() [2/2]

template<typename TYPE >
bool OSX::OSXThreadLocalPtr< TYPE >::isvalid ( ) const

test if content is valid

◆ set() [1/2]

template<typename TYPE >
void OSX::OSXThreadLocalPtr< TYPE >::set ( TYPE * p)

set content

◆ set() [2/2]

template<typename TYPE >
void OSX::OSXThreadLocalPtr< TYPE >::set ( TYPE * p)

set content

Member Data Documentation

◆ key

template<typename TYPE >
pthread_key_t OSX::OSXThreadLocalPtr< TYPE >::key
private

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