62 const bool delete_after_run =
e->todelete();
64 if (delete_after_run) {
80#ifdef GECODE_HAS_THREADS
92 class GlobalMutexRunnable :
public Runnable {
101 GlobalMutexRunnable(
void) : _to_acquire(nullptr), _to_release(nullptr) {}
102 virtual void run(
void) {
107 _to_acquire =
nullptr;
109 }
else if (_to_release) {
111 _to_release =
nullptr;
118 void acquire(Mutex* m) {
127 void release(Mutex* m) {
138 class GlobalMutexRunnableInit {
140 GlobalMutexRunnable* gmr;
141 GlobalMutexRunnableInit(
void) : gmr(new GlobalMutexRunnable) {
147 globalMutexRunnable(
void) {
148 static GlobalMutexRunnableInit gmri;
155 globalMutexRunnable().acquire(
m);
160 globalMutexRunnable().release(
m);
Exception: operating system error
An event for synchronization.
void wait(void)
Wait until the event becomes signalled.
void signal(void)
Signal the event.
A mutex for mutual exclausion among several threads.
void release(void)
Release the mutex.
void acquire(void)
Acquire the mutex and possibly block.
An interface for objects that can be run by a thread.
An interface for objects that can be called after a thread has terminated (after running the thread's...
virtual void terminated(void)=0
The function that is called when the thread has terminated.
void exec(void)
Infinite loop for execution.
Event e
Event to wait for next runnable object to execute.
std::atomic< Runnable * > r
Runnable object to execute.
Run(Runnable *r)
Create a new thread.
static void releaseGlobalMutex(Mutex *m)
release globally acquired mutex m
static Run * idle
Idle runners.
static void acquireGlobalMutex(Mutex *m)
acquire mutex m globally and possibly lock
static Mutex * m(void)
Mutex for synchronization.
Support algorithms and datastructures
Gecode toplevel namespace
Multi _e(Gecode::IntArgs({4, 2, 3, 1}))
#define GECODE_ASSUME(p)
Assert certain property.