DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.
[STR New]
Link: http://www.fltk.org/str.php?L2543
Version: 1.3-current
Attached file "lock.patch"...
Link: http://www.fltk.org/str.php?L2543
Version: 1.3-current
Index: FL/Fl.H
===================================================================
--- FL/Fl.H (revision 8323)
+++ FL/Fl.H (working copy)
@@ -975,7 +975,7 @@
@{ */
// Multithreading support:
- static void lock();
+ static int lock();
static void unlock();
static void awake(void* message = 0);
/** See void awake(void* message=0). */
Index: src/Fl_lock.cxx
===================================================================
--- src/Fl_lock.cxx (revision 8287)
+++ src/Fl_lock.cxx (working copy)
@@ -135,12 +135,13 @@
////////////////////////////////////////////////////////////////
// Windows threading...
-/** \fn void Fl::lock()
+/** \fn int Fl::lock()
The lock() method blocks the current thread until it
can safely access FLTK widgets and data. Child threads should
call this method prior to updating any widgets or accessing
data. The main thread must call lock() to initialize
- the threading support in FLTK.
+ the threading support in FLTK. lock() will return non-zero
+ iff threading is not available on the platform.
Child threads must call unlock() when they are done
accessing FLTK.
@@ -150,6 +151,8 @@
Similarly, when the main thread needs to do processing, it will
wait until all child threads have called unlock() before processing
additional data.
+
+ \return Non-zero iff threading is not available on the platform.
See also: \ref advanced_multithreading
*/
@@ -230,7 +233,7 @@
EnterCriticalSection(&cs);
}
-void Fl::lock() {
+int Fl::lock() {
if (!main_thread) InitializeCriticalSection(&cs);
lock_function();
@@ -240,6 +243,7 @@
fl_unlock_function = unlock_function;
main_thread = GetCurrentThreadId();
}
+ return 0;
}
void Fl::unlock() {
@@ -329,7 +333,7 @@
extern void (*fl_lock_function)();
extern void (*fl_unlock_function)();
-void Fl::lock() {
+int Fl::lock() {
if (!thread_filedes[1]) {
// Initialize thread communication pipe to let threads awake FLTK
// from Fl::wait()
@@ -364,6 +368,7 @@
}
fl_lock_function();
+ return 0;
}
void Fl::unlock() {
@@ -396,6 +401,17 @@
void Fl::awake(void*) {
}
+int Fl::lock() {
+ return 1;
+}
+
+void Fl::unlock() {
+}
+
+void* Fl::thread_message() {
+ return NULL;
+}
+
#endif // WIN32
//
_______________________________________________
fltk-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-bugs