diff options
author | dec05eba <dec05eba@protonmail.com> | 2019-03-18 23:47:45 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-07-25 14:36:46 +0200 |
commit | 2323ca6c9ec3c8ee76b9acf13745b80b92952a6a (patch) | |
tree | 93013237dbcb0fa96ceb5f3c026fd040aff464cf /include/std/thread.h | |
parent | 5a93c32a59775cd1be4b4f450e8230016b434366 (diff) |
Add struct, import caching, binop ops etc
Diffstat (limited to 'include/std/thread.h')
-rw-r--r-- | include/std/thread.h | 3 |
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); |