summaryrefslogtreecommitdiff
path: root/src/thread/lock_ptc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/thread/lock_ptc.c')
-rw-r--r--src/thread/lock_ptc.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/thread/lock_ptc.c b/src/thread/lock_ptc.c
new file mode 100644
index 00000000..7adedab7
--- /dev/null
+++ b/src/thread/lock_ptc.c
@@ -0,0 +1,18 @@
+#include <pthread.h>
+
+static pthread_rwlock_t lock = PTHREAD_RWLOCK_INITIALIZER;
+
+void __inhibit_ptc()
+{
+ pthread_rwlock_wrlock(&lock);
+}
+
+void __acquire_ptc()
+{
+ pthread_rwlock_rdlock(&lock);
+}
+
+void __release_ptc()
+{
+ pthread_rwlock_unlock(&lock);
+}