diff options
| author | maxim nikonov <maxim.nikonov@hqo.co> | 2026-02-05 21:32:25 +0500 |
|---|---|---|
| committer | maxim nikonov <maxim.nikonov@hqo.co> | 2026-02-05 21:32:25 +0500 |
| commit | dc39575fb3ef90e5a2689babe7fb335cd88f6727 (patch) | |
| tree | 24f6cef8f2b558ae6f1f812c75be0c09a53fe417 /src/drivers/Posix/Fl_Posix_System_Driver.cxx | |
| parent | 7d3793ce1d8cb26e7608bf859beca21359cec6e9 (diff) | |
wip
Diffstat (limited to 'src/drivers/Posix/Fl_Posix_System_Driver.cxx')
| -rw-r--r-- | src/drivers/Posix/Fl_Posix_System_Driver.cxx | 11 |
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; |
