summaryrefslogtreecommitdiff
path: root/mt.h
diff options
context:
space:
mode:
authorTom Smeding <tom.smeding@gmail.com>2018-08-01 23:12:41 +0200
committerTom Smeding <tom.smeding@gmail.com>2018-08-01 23:12:41 +0200
commita239f9feadd015fa91d391df01365dcade8ce503 (patch)
tree979554817c2069a525e94e2ad5f6346b53e19eb5 /mt.h
parent9f2fccfdc2eae83efbde1e3ae94a2cc220537983 (diff)
Threaded communication (icmpd)
Diffstat (limited to 'mt.h')
-rw-r--r--mt.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/mt.h b/mt.h
new file mode 100644
index 0000000..57afd5c
--- /dev/null
+++ b/mt.h
@@ -0,0 +1,23 @@
+#pragma once
+
+#include <pthread.h>
+
+
+// The structs in this file should be considered opaque.
+
+
+struct mt_mutex {
+ pthread_mutex_t m;
+};
+
+void mt_mutex_init(struct mt_mutex *mut);
+void mt_mutex_destroy(struct mt_mutex *mut);
+void mt_mutex_lock(struct mt_mutex *mut);
+void mt_mutex_unlock(struct mt_mutex *mut);
+
+struct mt_thread {
+ pthread_t t;
+};
+
+void mt_thread_create(struct mt_thread *th, void* (*callback)(void*), void *arg);
+void* mt_thread_join(struct mt_thread *th);