From 2323ca6c9ec3c8ee76b9acf13745b80b92952a6a Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 18 Mar 2019 23:47:45 +0100 Subject: Add struct, import caching, binop ops etc --- include/std/thread.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/std/thread.h') 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); -- cgit v1.2.3