Solaris 2.x Event Class

The following is the implementation of the Event class on Solaris 2.x.

class Event { private: cond_t event; // in order to wait on a condition variable you must have a locked // mutex, which we don't really need. mutex_t dummy_mutex; public: Event(void) { cond_init(&event, USYNC_PROCESS, (void*)0); mutex_init(&dummy_mutex, USYNC_PROCESS, (void*)0); } ~Event(void) { event_destroy(&event); } void Signal(void) { cond_broadcast(&event); } void Wait(void) { mutex_lock(&dummy_mutex); cond_wait(&event, &dummy_mutex); mutex_unlock(&dummy_mutex); } };