summaryrefslogtreecommitdiff
path: root/src/Threads.cc
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2011-10-09 22:58:44 -0700
committerPixel <pixel@nobis-crew.org>2011-10-09 22:58:44 -0700
commitcf9a801ebcb4df0a8b1ea75e58ca8ea8960ba13b (patch)
treed27f9bf411f2c8d222a85935dec09a2616f61681 /src/Threads.cc
parent4010635b9c3d74e544d37d1e9295316cff01b014 (diff)
Adding basic locks from libpthread. Also, that 'pending' loop belongs after we activate the tasks.
Diffstat (limited to 'src/Threads.cc')
-rw-r--r--src/Threads.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/Threads.cc b/src/Threads.cc
new file mode 100644
index 0000000..7c928f8
--- /dev/null
+++ b/src/Threads.cc
@@ -0,0 +1,13 @@
+#include <Exceptions.h>
+#include <Threads.h>
+
+Balau::Lock::Lock() {
+ int r;
+ pthread_mutexattr_t attr;
+ r = pthread_mutexattr_init(&attr);
+ Assert(r == 0);
+ r = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+ Assert(r == 0);
+ r = pthread_mutex_init(&m_lock, &attr);
+ Assert(r == 0);
+}