aboutsummaryrefslogtreecommitdiff
path: root/x11.cpp
diff options
context:
space:
mode:
authorLionel Ulmer2002-06-04 18:18:44 +0000
committerLionel Ulmer2002-06-04 18:18:44 +0000
commit31a2efd89cdae6f8722af77177dba2a7763a94a5 (patch)
tree7aff5d5b39d746e20bd58de40e2857bce59d7788 /x11.cpp
parent08cdef16191c9ea6cdf8611a24d74748533be6d4 (diff)
downloadscummvm-rg350-31a2efd89cdae6f8722af77177dba2a7763a94a5.tar.gz
scummvm-rg350-31a2efd89cdae6f8722af77177dba2a7763a94a5.tar.bz2
scummvm-rg350-31a2efd89cdae6f8722af77177dba2a7763a94a5.zip
Sorry for the mess.... Here is the mutex code :-)
svn-id: r4403
Diffstat (limited to 'x11.cpp')
-rw-r--r--x11.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/x11.cpp b/x11.cpp
index 3de40c70a8..ae104c5376 100644
--- a/x11.cpp
+++ b/x11.cpp
@@ -116,6 +116,12 @@ public:
// Add a callback timer
void set_timer(int timer, int (*callback)(int));
+ // Mutex handling
+ void *create_mutex(void);
+ void lock_mutex(void *mutex);
+ void unlock_mutex(void *mutex);
+ void delete_mutex(void *mutex);
+
static OSystem *create(int gfx_mode, bool full_screen);
private:
@@ -936,3 +942,22 @@ void OSystem_X11::set_timer(int timer, int (*callback)(int)) {
_timer_active = false;
}
}
+
+void *OSystem_X11::create_mutex(void) {
+ pthread_mutex_t *mutex = (pthread_mutex_t *) malloc(sizeof(pthread_mutex_t));
+ pthread_mutex_init(mutex, NULL);
+ return (void *) mutex;
+}
+
+void OSystem_X11::lock_mutex(void *mutex) {
+ pthread_mutex_lock((pthread_mutex_t *) mutex);
+}
+
+void OSystem_X11::unlock_mutex(void *mutex) {
+ pthread_mutex_unlock((pthread_mutex_t *) mutex);
+}
+
+void OSystem_X11::delete_mutex(void *mutex) {
+ pthread_mutex_destroy((pthread_mutex_t *) mutex);
+ free(mutex);
+}