Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
Arcane::ThreadPrivate< T > Class Template Reference

Class allowing an instance of a type per thread. More...

#include <arccore/concurrency/ThreadPrivate.h>

Public Member Functions

 ThreadPrivate (ThreadPrivateStorage *key)
T * item ()
 Instance specific to the current thread.

Detailed Description

template<typename T>
class Arcane::ThreadPrivate< T >

Class allowing an instance of a type per thread.

The container allowing values to be stored must be passed as an argument to the constructor. This container must have been initialized via ThreadPrivateStorage::initialize() before using this class.

This class only has one method item() allowing retrieval of an instance of type T per thread. On the first call to item() for a given thread, an instance of T is constructed. The type T must have a default constructor and must have a build() method. \threadsafeclass

Deprecated
Use 'thread_local' from C++11.

Definition at line 142 of file ThreadPrivate.h.

Constructor & Destructor Documentation

◆ ThreadPrivate()

template<typename T>
Arcane::ThreadPrivate< T >::ThreadPrivate ( ThreadPrivateStorage * key)
inline

Definition at line 148 of file ThreadPrivate.h.

◆ ~ThreadPrivate()

template<typename T>
Arcane::ThreadPrivate< T >::~ThreadPrivate ( )
inline

Definition at line 153 of file ThreadPrivate.h.

Member Function Documentation

◆ item()

template<typename T>
T * Arcane::ThreadPrivate< T >::item ( )
inline

Instance specific to the current thread.

Definition at line 162 of file ThreadPrivate.h.


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