From ba2be02ab24d170bb03662a8a5f5893f0112aeb7 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Thu, 6 Dec 2001 22:16:49 +0000 Subject: FLTK 2.0 threading support under FLTK 1.1. Needs porting to OSX. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1819 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_x.cxx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/Fl_x.cxx') diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx index 5788181d6..7572d7d02 100644 --- a/src/Fl_x.cxx +++ b/src/Fl_x.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_x.cxx,v 1.24.2.24.2.7 2001/11/27 17:44:06 easysw Exp $" +// "$Id: Fl_x.cxx,v 1.24.2.24.2.8 2001/12/06 22:16:49 easysw Exp $" // // X specific code for the Fast Light Tool Kit (FLTK). // @@ -179,6 +179,11 @@ static void do_queued_events() { # endif } +// these pointers are set by the Fl::lock() function: +static void nothing() {} +void (*fl_lock_function)() = nothing; +void (*fl_unlock_function)() = nothing; + // This is never called with time_to_wait < 0.0: // It should return negative on error, 0 if nothing happens before // timeout, and >0 if any callbacks were done. @@ -197,6 +202,8 @@ int fl_wait(double time_to_wait) { # endif int n; + fl_unlock_function(); + if (time_to_wait < 2147483.648) { # if USE_POLL n = ::poll(pollfds, nfds, int(time_to_wait*1000 + .5)); @@ -213,6 +220,9 @@ int fl_wait(double time_to_wait) { n = ::select(maxfd+1,&fdt[0],&fdt[1],&fdt[2],0); # endif } + + fl_lock_function(); + if (n > 0) { for (int i=0; i