Fixed a compile problem with the Linux 2.6 threading support

(STR #483)


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@3820 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet 2004-09-12 03:46:21 +00:00
parent 421904a7c1
commit 35af1c00cc
2 changed files with 13 additions and 7 deletions

View File

@ -3,6 +3,8 @@ CHANGES IN FLTK 1.1.5rc3
- Documentation updates (STR #505, STR #513)
- Updated PNG library source to 1.2.6 + wutil patch.
- Updated ZLIB library source to 1.2.1.
- Fixed a compile problem with the Linux 2.6 threading
support (STR #483)
- Fixed problems with 2-byte Xpm files on 64-bit
platforms (STR #525)
- FLTK didn't handle the ReparentNotify event on X11

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_lock.cxx,v 1.13.2.5 2004/04/11 04:38:59 easysw Exp $"
// "$Id: Fl_lock.cxx,v 1.13.2.6 2004/09/12 03:46:21 easysw Exp $"
//
// Multi-threading support code for the Fast Light Tool Kit (FLTK).
//
@ -127,12 +127,19 @@ void Fl::awake(void* msg) {
# include <unistd.h>
# include <pthread.h>
# ifdef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
# if defined (PTHREAD_MUTEX_RECURSIVE_NP)
// Linux supports recursive locks, use them directly:
static pthread_mutex_t fltk_mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
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);
}
@ -140,9 +147,6 @@ void Fl::unlock() {
pthread_mutex_unlock(&fltk_mutex);
}
// this is needed for the Fl_Mutex constructor:
pthread_mutexattr_t Fl_Mutex_attrib = {PTHREAD_MUTEX_RECURSIVE_NP};
# else
// Make a recursive lock out of the pthread mutex:
@ -200,5 +204,5 @@ void Fl::awake(void* msg) {
#endif
//
// End of "$Id: Fl_lock.cxx,v 1.13.2.5 2004/04/11 04:38:59 easysw Exp $".
// End of "$Id: Fl_lock.cxx,v 1.13.2.6 2004/09/12 03:46:21 easysw Exp $".
//