diff options
author | Lionel Ulmer | 2002-06-04 18:18:44 +0000 |
---|---|---|
committer | Lionel Ulmer | 2002-06-04 18:18:44 +0000 |
commit | 31a2efd89cdae6f8722af77177dba2a7763a94a5 (patch) | |
tree | 7aff5d5b39d746e20bd58de40e2857bce59d7788 /x11.cpp | |
parent | 08cdef16191c9ea6cdf8611a24d74748533be6d4 (diff) | |
download | scummvm-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.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -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); +} |