1 /***********************************************************
2 * Copyright (C) 1997, Be Inc. All rights reserved.
6 * DESCRIPTION: helper class for GLUT event loop.
7 * if a window receives an event, wake up the event loop.
8 ***********************************************************/
10 /***********************************************************
12 ***********************************************************/
13 #include <kernel/OS.h>
15 /***********************************************************
18 * DESCRIPTION: Fairly naive, but safe implementation.
19 * global semaphore controls access to state
20 * event semaphore blocks WaitEvent() call if necessary
21 * (this is basically a condition variable class)
22 ***********************************************************/
27 void WaitEvent(); // wait for new event
28 void WaitEvent(bigtime_t usecs
); // wait with timeout
29 void NewEvent(); // new event from a window (may need to wakeup main thread)
30 void QuickNewEvent() { events
= true; } // new event from main thread
31 void ClearEvents() { events
= false; } // clear counter at beginning of event loop
32 bool PendingEvent() { return events
; } // XPending() equivalent
36 bool events
; // are there any new events?
37 bool sleeping
; // is someone sleeping on eSem?
40 /***********************************************************
42 ***********************************************************/
43 extern GlutBlocker gBlock
;