12#ifndef ARCCORE_CONCURRENCY_THREADPRIVATE_H
13#define ARCCORE_CONCURRENCY_THREADPRIVATE_H
17#include "arccore/base/ArccoreGlobal.h"
19#include "arccore/concurrency/GlibAdapter.h"
39class ARCCORE_CONCURRENCY_EXPORT ThreadPrivateStorage
43 ARCCORE_DEPRECATED_REASON(
"Y2022; This class is deprecated. Use 'thread_local' specifier.")
44 ThreadPrivateStorage();
45 ~ThreadPrivateStorage();
59 void setValue(
void* v);
73class ARCCORE_CONCURRENCY_EXPORT ThreadPrivateBase
82 virtual void* createInstance() = 0;
87 ARCCORE_DEPRECATED_REASON(
"Y2022; This class is deprecated. Use 'thread_local' specifier.")
90 , m_create_functor(create_functor)
114 ThreadPrivateStorage* m_key;
116 ICreateFunctor* m_create_functor;
144 ARCCORE_DEPRECATED_REASON(
"Y2022; This class is deprecated. Use 'thread_local' specifier.")
146 : m_storage(key,
this)
152 for (T*
item : m_allocated_items)
161 return (T*)(m_storage.item());
166 void* createInstance()
override
168 T* new_ptr =
new T();
170 m_allocated_items.push_back(new_ptr);
176 std::vector<T*> m_allocated_items;
177 ThreadPrivateBase m_storage;
Encapsule un GPrivate de la glib.
Classe de base permettant de conserveur une instance d'un objet par thread.
Conteneur pour les valeurs privées par thread.
void initialize()
Initialise la clé contenant les valeurs par thread. Cette méthode peut être appelée plusieurs fois et...
T * item()
Instance spécifique au thread courant.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-