summaryrefslogtreecommitdiff
path: root/src/drivers/Posix/Fl_Posix_System_Driver.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/Posix/Fl_Posix_System_Driver.cxx')
-rw-r--r--src/drivers/Posix/Fl_Posix_System_Driver.cxx11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/drivers/Posix/Fl_Posix_System_Driver.cxx b/src/drivers/Posix/Fl_Posix_System_Driver.cxx
index 299a1b901..babcc758b 100644
--- a/src/drivers/Posix/Fl_Posix_System_Driver.cxx
+++ b/src/drivers/Posix/Fl_Posix_System_Driver.cxx
@@ -322,7 +322,6 @@ int Fl_Posix_System_Driver::close_fd(int fd) { return close(fd); }
# include <fcntl.h>
# include <pthread.h>
# include <sys/ioctl.h>
-# include <mutex> // for std::mutex (since C++11)
// Pipe for thread messaging via Fl::awake()...
static int thread_filedes[2];
@@ -372,12 +371,12 @@ static void unlock_function_rec() {
// -- Start of "awake" implementation --
static void* thread_message_ = 0;
-static std::mutex pipe_mutex;
+static pthread_mutex_t pipe_mutex = PTHREAD_MUTEX_INITIALIZER;
void Fl_Posix_System_Driver::awake(void* msg) {
thread_message_ = msg;
if (thread_filedes[1]) {
- pipe_mutex.lock();
+ pthread_mutex_lock(&pipe_mutex);
int avail = 0;
ioctl(thread_filedes[0], FIONREAD, &avail);
if (avail == 0) {
@@ -385,7 +384,7 @@ void Fl_Posix_System_Driver::awake(void* msg) {
char dummy = 0;
if (write(thread_filedes[1], &dummy, 1)==0) { /* ignore */ }
}
- pipe_mutex.unlock();
+ pthread_mutex_unlock(&pipe_mutex);
}
}
@@ -397,10 +396,10 @@ void* Fl_Posix_System_Driver::thread_message() {
static void thread_awake_cb(int fd, void*) {
if (thread_filedes[1]) {
- pipe_mutex.lock();
+ pthread_mutex_lock(&pipe_mutex);
char dummy = 0;
if (read(fd, &dummy, 1)==0) { /* This should never happen */ }
- pipe_mutex.unlock();
+ pthread_mutex_unlock(&pipe_mutex);
}
Fl_Awake_Handler func;
void *data;