From cf9a801ebcb4df0a8b1ea75e58ca8ea8960ba13b Mon Sep 17 00:00:00 2001 From: Pixel Date: Sun, 9 Oct 2011 22:58:44 -0700 Subject: Adding basic locks from libpthread. Also, that 'pending' loop belongs after we activate the tasks. --- src/Threads.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/Threads.cc (limited to 'src/Threads.cc') 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 +#include + +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); +} -- cgit v1.2.3