aboutsummaryrefslogtreecommitdiff
path: root/include/std/thread.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/std/thread.h')
-rw-r--r--include/std/thread.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/std/thread.h b/include/std/thread.h
index 915d6a9..6eedb08 100644
--- a/include/std/thread.h
+++ b/include/std/thread.h
@@ -29,6 +29,8 @@ typedef enum {
struct amal_mutex {
pthread_mutex_t mutex;
const char *lock_identifier;
+ bool locked;
+ pthread_t owner_thread;
};
CHECK_RESULT int amal_thread_create(amal_thread *self, amal_thread_type thread_type, const char *name, AmalThreadCallbackFunc callback_func, void *userdata);
@@ -40,6 +42,7 @@ CHECK_RESULT int amal_thread_join(amal_thread *self, void **result);
void amal_mutex_init(amal_mutex *self);
void amal_mutex_deinit(amal_mutex *self);
CHECK_RESULT int amal_mutex_lock(amal_mutex *self, const char *lock_identifier);
+/* Safe to call unlock when another thread owns the lock or if the lock is not locked */
CHECK_RESULT int amal_mutex_unlock(amal_mutex *self);
void amal_mutex_tryunlock(amal_mutex *self);