From b7be6fb47e88e0d39a1ba3513dbb5ea69dd98935 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Sun, 28 Jan 2007 20:26:50 +0000 Subject: 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 --- src/Fl_lock.cxx | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) (limited to 'src') 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]; -- cgit v1.2.3