diff options
author | Prefetch | 2023-07-22 19:22:06 +0200 |
---|---|---|
committer | Prefetch | 2023-07-22 19:22:06 +0200 |
commit | 7231a21b00028a52d7938131bfeca4d663d09071 (patch) | |
tree | a2afa76ab0645b4d9a2b427cbd9ff9d312e47d07 /linen.h | |
parent | bdf186e13258abd9c5fb932d84a7ea1e15c7d933 (diff) |
Add locks, with some minor improvements to threads
Diffstat (limited to 'linen.h')
-rw-r--r-- | linen.h | 21 |
1 files changed, 20 insertions, 1 deletions
@@ -5,9 +5,28 @@ #error "Linen (libinen.so) only works on x86_64 Linux!" #endif -typedef int* linen_thread_t; +#include <stdint.h> + + +typedef struct { + uint32_t futex; + uint32_t magic; +} *linen_thread_t; extern int linen_thread_create(linen_thread_t* handle, void* (*func)(void*), void* arg); extern int linen_thread_finish(linen_thread_t handle, void** retval); + +typedef struct { + uint32_t futex; + uint32_t count; + uint32_t magic; +} linen_lock_t; + +#define LINEN_LOCK_INITIALIZER { 0, 0, 0xCAFEBABE } + +extern int linen_lock_acquire(linen_lock_t* handle); +extern int linen_lock_release(linen_lock_t* handle); + + #endif /* _LINEN_H_ */ |