43 #ifdef GECODE_THREADS_WINDOWS 50 # define _WIN32_WINNT 0x400 53 #ifndef WIN32_LEAN_AND_MEAN 54 # define WIN32_LEAN_AND_MEAN 61 #ifdef GECODE_THREADS_PTHREADS 65 #ifdef GECODE_THREADS_OSX 67 #include <libkern/OSAtomic.h> 71 #ifdef GECODE_THREADS_OSX_UNFAIR 94 namespace Gecode {
namespace Support {
107 #if defined(GECODE_THREADS_WINDOWS) 108 CRITICAL_SECTION w_cs;
110 #elif defined(GECODE_THREADS_OSX_UNFAIR) 113 #elif defined(GECODE_THREADS_PTHREADS) 117 #error No suitable mutex implementation found 131 static void*
operator new(
size_t s);
133 static void operator delete(
void*
p);
138 void operator=(
const Mutex&) {}
141 #ifndef GECODE_THREADS_PTHREADS_SPINLOCK 164 pthread_spinlock_t p_s;
177 static void*
operator new(
size_t s);
179 static void operator delete(
void*
p);
184 void operator=(
const FastMutex&) {}
207 void operator=(
const Lock&) {}
220 #ifdef GECODE_THREADS_WINDOWS 224 #ifdef GECODE_THREADS_PTHREADS 245 void operator=(
const Event&) {}
259 virtual void terminated(
void) = 0;
275 void todelete(
bool d);
277 bool todelete(
void)
const;
281 virtual void run(
void) = 0;
285 static void*
operator new(
size_t s);
287 static void operator delete(
void*
p);
319 static void*
operator new(
size_t s);
321 static void operator delete(
void*
p);
339 static void sleep(
unsigned int ms);
341 static unsigned int npu(
void);
346 void operator=(
const Thread&) {}
Mutex m
Mutex for synchronization.
virtual ~Runnable(void)
Destructor.
An interface for objects that can be run by a thread.
Mutex(void)
Initialize mutex.
void acquire(void)
Acquire the mutex and possibly block.
Runnable * r
Runnable object to execute.
virtual ~Terminator()
Destructor.
A mutex for mutual exclausion among several threads.
void release(void)
Release the mutex.
int p
Number of positive literals for node type.
An event for synchronization.
A lock as a scoped frontend for a mutex.
virtual Terminator * terminator(void) const
Return terminator object.
void wait(Home home, FloatVar x, std::function< void(Space &home)> c)
Execute c when x becomes assigned.
bool tryacquire(void)
Try to acquire the mutex, return true if succesful.
#define GECODE_SUPPORT_EXPORT
~Mutex(void)
Delete mutex.
static Run * idle
Idle runners.
Post propagator for SetVar SetOpType SetVar SetRelType r
Event e
Event to wait for next runnable object to execute.
An interface for objects that can be called after a thread has terminated (after running the thread's...
Gecode toplevel namespace