diff options
author | dec05eba <dec05eba@protonmail.com> | 2019-03-22 20:48:40 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-07-25 14:36:46 +0200 |
commit | 4f308829ad0e81a59971e172284c018cf2bdca3d (patch) | |
tree | eb11a69a471e31aa7be8e46bce6d1b3ded28e056 /include/std/thread.h | |
parent | 5df7f92e715ba764ee57f65d78e73111492bb64c (diff) |
Add mutex for lhs expr, add error for missing lhs expr for func, struct
TODO: Use mutex in lhs expr and set resolved_type
Diffstat (limited to 'include/std/thread.h')
-rw-r--r-- | include/std/thread.h | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/include/std/thread.h b/include/std/thread.h index 6eedb08..356ebf0 100644 --- a/include/std/thread.h +++ b/include/std/thread.h @@ -13,6 +13,8 @@ typedef void* (AmalThreadCallbackFunc)(void *userdata); #define AMAL_THREAD_ERR -1 #define AMAL_THREAD_NOT_JOINABLE -23 +/*#define AMAL_MUTEX_DEBUG*/ + struct amal_thread { pthread_t thread_id; pthread_attr_t thread_attr; @@ -28,7 +30,9 @@ typedef enum { struct amal_mutex { pthread_mutex_t mutex; + #ifdef AMAL_MUTEX_DEBUG const char *lock_identifier; + #endif bool locked; pthread_t owner_thread; }; @@ -39,6 +43,10 @@ CHECK_RESULT int amal_thread_deinit(amal_thread *self); CHECK_RESULT int amal_thread_detach(amal_thread *self); CHECK_RESULT int amal_thread_join(amal_thread *self, void **result); +bool amal_thread_is_main(); +/* Returns 0 if the number of usable threads is unknown */ +int amal_get_usable_thread_count(); + 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); @@ -46,9 +54,4 @@ CHECK_RESULT int amal_mutex_lock(amal_mutex *self, const char *lock_identifier); CHECK_RESULT int amal_mutex_unlock(amal_mutex *self); void amal_mutex_tryunlock(amal_mutex *self); -bool amal_thread_is_main(); - -/* Returns 0 if the number of usable threads is unknown */ -int amal_get_usable_thread_count(); - #endif |