38 namespace Gecode {
namespace Support {
45 InitializeCriticalSection(&w_cs);
49 EnterCriticalSection(&w_cs);
53 return TryEnterCriticalSection(&w_cs) != 0;
57 LeaveCriticalSection(&w_cs);
61 DeleteCriticalSection(&w_cs);
70 : w_h(CreateEvent(NULL, FALSE, FALSE, NULL)) {
72 throw OperatingSystemError(
"Event::Event[Windows::CreateEvent]");
76 if (SetEvent(w_h) == 0)
77 throw OperatingSystemError(
"Event::signal[Windows::SetEvent]");
81 if (WaitForSingleObject(w_h,INFINITE) != 0)
82 throw OperatingSystemError(
"Event::wait[Windows::WaitForSingleObject]");
86 if (CloseHandle(w_h) == 0)
87 throw OperatingSystemError(
"Event::~Event[Windows::CloseHandle]");
96 Sleep(static_cast<DWORD>(ms));
103 return static_cast<unsigned int>(si.dwNumberOfProcessors);