summaryrefslogtreecommitdiff
path: root/src/Threads.cc
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2011-12-05 09:16:42 -0800
committerPixel <pixel@nobis-crew.org>2011-12-05 09:16:42 -0800
commit2f36082049c30562f2cb3061438c4aaebc8d8fe5 (patch)
treec1a93f96750cce63e9801b0907499c8a4d2b969e /src/Threads.cc
parentb419f3e159212c9998b3f86c1fee332620472f4e (diff)
Adding read-write locks, and applying them immediately to the http server.
Diffstat (limited to 'src/Threads.cc')
-rw-r--r--src/Threads.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/Threads.cc b/src/Threads.cc
index de70933..fe90394 100644
--- a/src/Threads.cc
+++ b/src/Threads.cc
@@ -22,6 +22,20 @@ Balau::Lock::Lock() {
RAssert(r == 0, "Couldn't set mutex attribute; r = %i", r);
r = pthread_mutex_init(&m_lock, &attr);
RAssert(r == 0, "Couldn't initialize mutex; r = %i", r);
+ r = pthread_mutexattr_destroy(&attr);
+ RAssert(r == 0, "Couldn't destroy mutex attribute; r = %i", r);
+}
+
+Balau::RWLock::RWLock() {
+ int r;
+ pthread_rwlockattr_t attr;
+
+ r = pthread_rwlockattr_init(&attr);
+ RAssert(r == 0, "Couldn't initialize rwlock attribute; r = %i", r);
+ r = pthread_rwlock_init(&m_lock, &attr);
+ RAssert(r == 0, "Couldn't initialize mutex; r = %i", r);
+ r = pthread_rwlockattr_destroy(&attr);
+ RAssert(r == 0, "Couldn't destroy rwlock attribute; r = %i", r);
}
void * Balau::ThreadHelper::threadProc(void * arg) {