14#include "arccore/concurrency/GlibAdapter.h"
26#define ARCCORE_GLIB_HAS_NEW_THREAD
43 Impl() ARCCORE_NOEXCEPT
46 m_mutex = &m_mutex_instance;
47 g_mutex_init(m_mutex);
51 g_mutex_clear(m_mutex);
54 GMutex* value()
const {
return m_mutex; }
55 void lock() { g_mutex_lock(m_mutex); }
56 void unlock() { g_mutex_unlock(m_mutex); }
58 GMutex m_mutex_instance;
66GlibMutex() ARCCORE_NOEXCEPT
77void GlibMutex::lock() { m_p->lock(); }
78void GlibMutex::unlock() { m_p->unlock(); }
80GlibMutex::Lock::Lock(GlibMutex& x) : m_mutex(x.m_p){ m_mutex->lock(); }
81GlibMutex::Lock::~Lock() { m_mutex->unlock(); }
87GPrivate null_gprivate = G_PRIVATE_INIT(
nullptr);
97 Impl() ARCCORE_NOEXCEPT
100 m_private_instance = null_gprivate;
101 m_private = &m_private_instance;
109 void setValue(
void* value)
111 g_private_set(m_private,value);
115 return g_private_get(m_private);
118 GPrivate m_private_instance;
137void GlibPrivate::create() { m_p->create(); }
138void GlibPrivate::setValue(
void* value) { m_p->setValue(value); }
139void* GlibPrivate::getValue() {
return m_p->getValue(); }
147 Impl() : m_cond(
nullptr)
149 m_cond = &m_cond_instance;
154 g_cond_clear(m_cond);
157 void broadcast() { g_cond_broadcast(m_cond); }
158 void wait(
GlibMutex::Impl* mutex) { g_cond_wait(m_cond,mutex->value()); }
160 GCond m_cond_instance;
168GlibCond::~GlibCond() {
delete m_p; }
169void GlibCond::broadcast() { m_p->broadcast(); }
170void GlibCond::wait(GlibMutex* mutex) { m_p->wait(mutex->m_p); }
Espace de nom de Arccore.