summaryrefslogtreecommitdiff
path: root/src/Fl_lock.cxx
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2016-04-11 19:14:47 +0000
committerManolo Gouy <Manolo>2016-04-11 19:14:47 +0000
commit64b3d26daa983b7a1394c82b080068cb1a056950 (patch)
tree543a65106a8057c7560e7ecf807ee2d140ee8660 /src/Fl_lock.cxx
parent1411c119058743cd1b5ae68f8d076f11b9f85c10 (diff)
Create Fl_X11_System_Driver.{cxx,.H} and share Fl_Posix_System_Driver.{cxx,.H} between Darwin and USE_X11 platforms.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11583 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_lock.cxx')
-rw-r--r--src/Fl_lock.cxx68
1 files changed, 13 insertions, 55 deletions
diff --git a/src/Fl_lock.cxx b/src/Fl_lock.cxx
index c80846d0c..5f1b79f41 100644
--- a/src/Fl_lock.cxx
+++ b/src/Fl_lock.cxx
@@ -21,9 +21,7 @@
#include <stdlib.h>
-#if defined(FL_CFG_GFX_QUARTZ)
-#include "drivers/Darwin/Fl_Darwin_System_Driver.H"
-#elif defined(FL_CFG_GFX_XLIB)
+#if defined(FL_CFG_SYS_POSIX)
#include "drivers/Posix/Fl_Posix_System_Driver.H"
#elif defined(FL_CFG_SYS_WIN32)
#include "drivers/WinAPI/Fl_WinAPI_System_Driver.H"
@@ -261,6 +259,9 @@ void Fl_WinAPI_System_Driver::awake(void* msg) {
}
#endif // FL_CFG_SYS_WIN32
+
+#if defined(FL_CFG_SYS_POSIX)
+
////////////////////////////////////////////////////////////////
// POSIX threading...
#if defined(HAVE_PTHREAD)
@@ -314,12 +315,12 @@ static void unlock_function_rec() {
}
# endif // PTHREAD_MUTEX_RECURSIVE
-static void posix_awake(void* msg) {
+void Fl_Posix_System_Driver::awake(void* msg) {
if (write(thread_filedes[1], &msg, sizeof(void*))==0) { /* ignore */ }
}
static void* thread_message_;
-static void* posix_thread_message() {
+void* Fl_Posix_System_Driver::thread_message() {
void* r = thread_message_;
thread_message_ = 0;
return r;
@@ -340,7 +341,7 @@ static void thread_awake_cb(int fd, void*) {
extern void (*fl_lock_function)();
extern void (*fl_unlock_function)();
-static int posix_lock() {
+int Fl_Posix_System_Driver::lock() {
if (!thread_filedes[1]) {
// Initialize thread communication pipe to let threads awake FLTK
// from Fl::wait()
@@ -378,7 +379,7 @@ static int posix_lock() {
return 0;
}
-static void posix_unlock() {
+void Fl_Posix_System_Driver::unlock() {
fl_unlock_function();
}
@@ -399,58 +400,15 @@ void lock_ring() {
#else
-#if defined(FL_CFG_GFX_QUARTZ) || defined(FL_CFG_GFX_XLIB)
-static void posix_awake(void*) {}
-static int posix_lock() { return 1; }
-static void posix_unlock() {}
-static void* posix_thread_message() { return NULL; }
-#endif
+static void Fl_Posix_System_Driver::awake(void*) {}
+static int Fl_Posix_System_Driver::lock() { return 1; }
+static void Fl_Posix_System_Driver::unlock() {}
+static void* Fl_Posix_System_Driver::thread_message() { return NULL; }
#endif // HAVE_PTHREAD
-#if defined(FL_CFG_GFX_QUARTZ)
-void Fl_Darwin_System_Driver::awake(void *v)
-{
- posix_awake(v);
-}
-int Fl_Darwin_System_Driver::lock()
-{
- return posix_lock();
-}
-
-void Fl_Darwin_System_Driver::unlock()
-{
- posix_unlock();
-}
-
-void* Fl_Darwin_System_Driver::thread_message()
-{
- return posix_thread_message();
-}
-#endif // FL_CFG_GFX_QUARTZ
-
-#if defined(FL_CFG_GFX_XLIB)
-void Fl_Posix_System_Driver::awake(void *v)
-{
- posix_awake(v);
-}
-
-int Fl_Posix_System_Driver::lock()
-{
- return posix_lock();
-}
-
-void Fl_Posix_System_Driver::unlock()
-{
- posix_unlock();
-}
-
-void* Fl_Posix_System_Driver::thread_message()
-{
- return posix_thread_message();
-}
-#endif // FL_CFG_GFX_XLIB
+#endif // FL_CFG_SYS_POSIX
void Fl::awake(void *v) {