From 2f36082049c30562f2cb3061438c4aaebc8d8fe5 Mon Sep 17 00:00:00 2001 From: Pixel Date: Mon, 5 Dec 2011 09:16:42 -0800 Subject: Adding read-write locks, and applying them immediately to the http server. --- includes/Threads.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'includes/Threads.h') diff --git a/includes/Threads.h b/includes/Threads.h index f6aed5a..67143ca 100644 --- a/includes/Threads.h +++ b/includes/Threads.h @@ -20,6 +20,17 @@ class Lock { friend class Queue; }; +class RWLock { + public: + RWLock(); + ~RWLock() { pthread_rwlock_destroy(&m_lock); } + void enterR() { pthread_rwlock_rdlock(&m_lock); } + void enterW() { pthread_rwlock_wrlock(&m_lock); } + void leave() { pthread_rwlock_unlock(&m_lock); } + private: + pthread_rwlock_t m_lock; +}; + class ThreadHelper; class Thread { -- cgit v1.2.3