diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 2007-01-28 20:26:50 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2007-01-28 20:26:50 +0000 |
| commit | b7be6fb47e88e0d39a1ba3513dbb5ea69dd98935 (patch) | |
| tree | 7f31153744147f47ee3734978e58cb7c33ab9658 /src/Fl_lock.cxx | |
| parent | 2fcd3610d57dacb6d4836991f05ea9728929c10d (diff) | |
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
Diffstat (limited to 'src/Fl_lock.cxx')
| -rw-r--r-- | src/Fl_lock.cxx | 27 |
1 files changed, 3 insertions, 24 deletions
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 <fcntl.h> # include <pthread.h> -# 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]; |
