1 /***********************************************************
2 * Copyright (C) 1997, Be Inc. Copyright (C) 1999, Jake Hamby.
4 * This program is freely distributable without licensing fees
5 * and is provided without guarantee or warrantee expressed or
6 * implied. This program is -not- in the public domain.
10 * DESCRIPTION: helper class for GLUT event loop.
11 * if a window receives an event, wake up the event loop.
12 ***********************************************************/
14 /***********************************************************
16 ***********************************************************/
17 #include <kernel/OS.h>
19 /***********************************************************
22 * DESCRIPTION: Fairly naive, but safe implementation.
23 * global semaphore controls access to state
24 * event semaphore blocks WaitEvent() call if necessary
25 * (this is basically a condition variable class)
26 ***********************************************************/
31 void WaitEvent(); // wait for new event
32 void WaitEvent(bigtime_t usecs
); // wait with timeout
33 void NewEvent(); // new event from a window (may need to wakeup main thread)
34 void QuickNewEvent() { events
= true; } // new event from main thread
35 void ClearEvents() { events
= false; } // clear counter at beginning of event loop
36 bool PendingEvent() { return events
; } // XPending() equivalent
40 bool events
; // are there any new events?
41 bool sleeping
; // is someone sleeping on eSem?
44 /***********************************************************
46 ***********************************************************/
47 extern GlutBlocker gBlock
;