From b7be6fb47e88e0d39a1ba3513dbb5ea69dd98935 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Sun, 28 Jan 2007 20:26:50 +0000 Subject: [PATCH] Drop recursive mutex code since the running kernel may not support it (STR #1575) git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5647 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- CHANGES | 3 +++ src/Fl_lock.cxx | 27 +++------------------------ 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/CHANGES b/CHANGES index bc7889ec2..4548ba08e 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,9 @@ CHANGES IN FLTK 1.1.8 - Fl::awake() could block on X11 and OSX (STR #1537) + - Dropped "native" recursive POSIX mutex support since the kernel's + underlying implementation may not support it even if the C + library does (STR #1575) - WIN32 did check callbacks after the event processing instead of before as documented (STR #1535) - Fl_File_Chooser now hides the window before doing a callback diff --git a/src/Fl_lock.cxx b/src/Fl_lock.cxx index 6f3b44f2c..6db23cdc5 100644 --- a/src/Fl_lock.cxx +++ b/src/Fl_lock.cxx @@ -130,28 +130,9 @@ void Fl::awake(void* msg) { # include # include -# ifdef PTHREAD_MUTEX_RECURSIVE_NP -// Linux supports recursive locks, use them directly: - -static bool minit; -static pthread_mutex_t fltk_mutex; -// this is needed for the Fl_Mutex constructor: -pthread_mutexattr_t Fl_Mutex_attrib = {PTHREAD_MUTEX_RECURSIVE_NP}; - -static void lock_function() { - if (!minit) { - pthread_mutex_init(&fltk_mutex, &Fl_Mutex_attrib); - minit = true; - } - pthread_mutex_lock(&fltk_mutex); -} - -void Fl::unlock() { - pthread_mutex_unlock(&fltk_mutex); -} - -# else // !PTHREAD_MUTEX_RECURSIVE_NP -// Make a recursive lock out of the pthread mutex: +// Make a recursive lock out of the pthread mutex; we don't use "native" +// recursive locks since they may not be implemented by the running kernel +// (see discussions in STR #1575) static pthread_mutex_t fltk_mutex = PTHREAD_MUTEX_INITIALIZER; static pthread_t owner; @@ -169,8 +150,6 @@ void Fl::unlock() { if (!--counter) pthread_mutex_unlock(&fltk_mutex); } -# endif // PTHREAD_MUTEX_RECURSIVE_NP - // Pipe for thread messaging... static int thread_filedes[2];