Пример #1
0
 Thread::Run::Run(Runnable* r0) {
   m.acquire();
   r = r0;
   m.release();
   // The Windows specific handle to a thread
   HANDLE w_h;
   w_h = CreateThread(NULL, 0, bootstrap, this, 0, NULL);
   if (w_h == NULL)
     throw OperatingSystemError("Thread::run[Windows::CreateThread]");
   if (CloseHandle(w_h) == 0)
     throw OperatingSystemError("Thread::run[Windows::CloseHandle]");
 }
Пример #2
0
 Thread::Run::Run(Runnable* r0) {
   m.acquire();
   r = r0;
   m.release();
   // The Pthread specific thread datastructure
   pthread_t p_t;
   if (pthread_create(&p_t, NULL, bootstrap, this) != 0)
     throw OperatingSystemError("Thread::run[pthread_create]");
 }
Пример #3
0
 forceinline
 Event::~Event(void) {
   if (CloseHandle(w_h) == 0)
     throw OperatingSystemError("Event::~Event[Windows::CloseHandle]");
 }
Пример #4
0
 forceinline void
 Event::wait(void) {
   if (WaitForSingleObject(w_h,INFINITE) != 0)
     throw OperatingSystemError("Event::wait[Windows::WaitForSingleObject]");
 }
Пример #5
0
 forceinline void
 Event::signal(void) {
   if (SetEvent(w_h) == 0)
     throw OperatingSystemError("Event::signal[Windows::SetEvent]");
 }
Пример #6
0
 /*
  * Event
  */
 forceinline
 Event::Event(void)
   : w_h(CreateEvent(NULL, FALSE, FALSE, NULL)) {
   if (w_h == NULL)
     throw OperatingSystemError("Event::Event[Windows::CreateEvent]");
 }
Пример #7
0
 /*
  * Thread
  */
 inline
 Thread::Run::Run(Runnable*) {
   throw OperatingSystemError("Thread::run[Threads not supported]");
 }