summaryrefslogtreecommitdiff
path: root/src/Fl_lock.cxx
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2007-02-08 23:04:20 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2007-02-08 23:04:20 +0000
commit6e9a1630357a21c6ef6357cdde324ae89a565826 (patch)
treeefc85bf8e365b2da7f6dd91e56f78fb5e4574604 /src/Fl_lock.cxx
parent057e542c395a8cc5391ee57a215c2c644a2fbd0b (diff)
Add handler for thread messages (STR #1536)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5683 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_lock.cxx')
-rw-r--r--src/Fl_lock.cxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/Fl_lock.cxx b/src/Fl_lock.cxx
index be52f78d1..31206c8e7 100644
--- a/src/Fl_lock.cxx
+++ b/src/Fl_lock.cxx
@@ -38,6 +38,14 @@
another. This file is an attempt to make minimal additions
and make them self-contained in this source file.
+ From Mike:
+
+ Starting with 1.1.8, we now have a callback so that you can
+ process awake() messages as they come in.
+
+
+ The API:
+
Fl::lock() - recursive lock. You must call this before the
first call to Fl::wait()/run() to initialize the thread
system. The lock is locked all the time except when
@@ -48,12 +56,17 @@
Fl::awake(void*) - Causes Fl::wait() to return (with the lock
locked) even if there are no events ready.
+ Fl::set_awake_cb(void (*cb)(void *)) - Registers a function
+ to call for Fl::awake() messages that is called for each
+ message received.
+
Fl::thread_message() - returns an argument sent to an
Fl::awake() call, or returns NULL if none. WARNING: the
current implementation only has a one-entry queue and only
returns the most recent value!
*/
+void (*Fl::awake_cb)(void *);
////////////////////////////////////////////////////////////////
// Windows threading...
@@ -189,6 +202,7 @@ void* Fl::thread_message() {
static void thread_awake_cb(int fd, void*) {
read(fd, &thread_message_, sizeof(void*));
+ if (Fl::awake_cb) (*Fl::awake_cb)(thread_message_);
}
// These pointers are in Fl_x.cxx: