mirror of https://github.com/fltk/fltk
Fl::awake() could block on X11 and OSX (STR #1537)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5646 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
ae8675a45f
commit
2fcd3610d5
1
CHANGES
1
CHANGES
|
@ -1,5 +1,6 @@
|
|||
CHANGES IN FLTK 1.1.8
|
||||
|
||||
- Fl::awake() could block on X11 and OSX (STR #1537)
|
||||
- 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
|
||||
|
|
|
@ -127,9 +127,10 @@ void Fl::awake(void* msg) {
|
|||
// POSIX threading...
|
||||
#elif HAVE_PTHREAD
|
||||
# include <unistd.h>
|
||||
# include <fcntl.h>
|
||||
# include <pthread.h>
|
||||
|
||||
# if defined (PTHREAD_MUTEX_RECURSIVE_NP)
|
||||
# ifdef PTHREAD_MUTEX_RECURSIVE_NP
|
||||
// Linux supports recursive locks, use them directly:
|
||||
|
||||
static bool minit;
|
||||
|
@ -149,7 +150,7 @@ void Fl::unlock() {
|
|||
pthread_mutex_unlock(&fltk_mutex);
|
||||
}
|
||||
|
||||
# else
|
||||
# else // !PTHREAD_MUTEX_RECURSIVE_NP
|
||||
// Make a recursive lock out of the pthread mutex:
|
||||
|
||||
static pthread_mutex_t fltk_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
@ -168,7 +169,7 @@ void Fl::unlock() {
|
|||
if (!--counter) pthread_mutex_unlock(&fltk_mutex);
|
||||
}
|
||||
|
||||
# endif
|
||||
# endif // PTHREAD_MUTEX_RECURSIVE_NP
|
||||
|
||||
// Pipe for thread messaging...
|
||||
static int thread_filedes[2];
|
||||
|
@ -193,6 +194,8 @@ void Fl::lock() {
|
|||
if (!thread_filedes[1]) { // initialize the mt support
|
||||
// Init threads communication pipe to let threads awake FLTK from wait
|
||||
pipe(thread_filedes);
|
||||
fcntl(thread_filedes[1], F_SETFL,
|
||||
fcntl(thread_filedes[1], F_GETFL) | O_NONBLOCK);
|
||||
Fl::add_fd(thread_filedes[0], FL_READ, thread_awake_cb);
|
||||
fl_lock_function = lock_function;
|
||||
fl_unlock_function = Fl::unlock;
|
||||
|
@ -203,7 +206,7 @@ void Fl::awake(void* msg) {
|
|||
write(thread_filedes[1], &msg, sizeof(void*));
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // WIN32
|
||||
|
||||
//
|
||||
// End of "$Id$".
|
||||
|
|
Loading…
Reference in New Issue