summaryrefslogtreecommitdiff
path: root/drivers/unix/rw_lock_posix.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/unix/rw_lock_posix.h')
-rw-r--r--drivers/unix/rw_lock_posix.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/drivers/unix/rw_lock_posix.h b/drivers/unix/rw_lock_posix.h
new file mode 100644
index 0000000000..bcc102f6a6
--- /dev/null
+++ b/drivers/unix/rw_lock_posix.h
@@ -0,0 +1,37 @@
+#ifndef RWLOCKPOSIX_H
+#define RWLOCKPOSIX_H
+
+#if defined(UNIX_ENABLED) || defined(PTHREAD_ENABLED)
+
+#include <pthread.h>
+#include "os/rw_lock.h"
+
+class RWLockPosix : public RWLock {
+
+
+ pthread_rwlock_t rwlock;
+
+ static RWLock *create_func_posix();
+
+public:
+
+ virtual void read_lock();
+ virtual void read_unlock();
+ virtual Error read_try_lock();
+
+ virtual void write_lock();
+ virtual void write_unlock();
+ virtual Error write_try_lock();
+
+ static void make_default();
+
+ RWLockPosix();
+
+ ~RWLockPosix();
+
+};
+
+#endif
+
+
+#endif // RWLOCKPOSIX_H