34namespace Gecode {
namespace Support {
41 InitializeCriticalSection(&w_cs);
45 EnterCriticalSection(&w_cs);
49 return TryEnterCriticalSection(&w_cs) != 0;
53 LeaveCriticalSection(&w_cs);
57 DeleteCriticalSection(&w_cs);
66 : w_h(CreateEvent(NULL, FALSE, FALSE, NULL)) {
68 throw OperatingSystemError(
"Event::Event[Windows::CreateEvent]");
72 if (SetEvent(w_h) == 0)
73 throw OperatingSystemError(
"Event::signal[Windows::SetEvent]");
77 if (WaitForSingleObject(w_h,INFINITE) != 0)
78 throw OperatingSystemError(
"Event::wait[Windows::WaitForSingleObject]");
83 if (CloseHandle(w_h) == 0) {
84 std::cerr <<
"Operating system error: "
85 <<
"Event::~Event[Windows::CloseHandle]";
95 Thread::sleep(
unsigned int ms) {
96 Sleep(
static_cast<DWORD
>(ms));
103 return static_cast<unsigned int>(
si.dwNumberOfProcessors);
Event(void)
Initialize event.
Mutex(void)
Initialize mutex.
~Mutex(void)
Delete mutex.
void release(void)
Release the mutex.
bool tryacquire(void)
Try to acquire the mutex, return true if succesful.
void acquire(void)
Acquire the mutex and possibly block.
Gecode toplevel namespace