ascii-chat 0.11.33
Video chat in your terminal
Loading...
Searching...
No Matches
threading.c File Reference

Threading abstraction for WASM/Emscripten using pthreads. More...

Go to the source code of this file.

Functions

int mutex_init (mutex_t *mutex, const char *name)
 Initialize a mutex with a name.
 
int mutex_destroy (mutex_t *mutex)
 Destroy a mutex.
 
int mutex_lock_impl (mutex_t *mutex)
 Lock a mutex (implementation function)
 
int mutex_trylock_impl (mutex_t *mutex)
 Try to lock a mutex without blocking (implementation function)
 
int mutex_unlock_impl (mutex_t *mutex)
 Unlock a mutex (implementation function)
 
int asciichat_thread_create (asciichat_thread_t *thread, const char *name, void *(*start_routine)(void *), void *arg)
 Create a new named thread.
 
int asciichat_thread_join (asciichat_thread_t *thread, void **retval)
 Wait for a thread to complete (blocking)
 
int asciichat_thread_detach (asciichat_thread_t *thread)
 Detach a thread so its resources are reclaimed when it exits.
 
asciichat_thread_t asciichat_thread_self (void)
 Get the current thread's ID.
 
int asciichat_thread_equal (asciichat_thread_t t1, asciichat_thread_t t2)
 Compare two thread IDs for equality.
 
int rwlock_init (rwlock_t *rwlock, const char *name)
 Initialize a read-write lock with a name.
 
int rwlock_rdlock_impl (rwlock_t *rwlock)
 Acquire a read lock (implementation function)
 
int rwlock_wrlock_impl (rwlock_t *rwlock)
 Acquire a write lock (implementation function)
 
int rwlock_rdunlock_impl (rwlock_t *rwlock)
 Release a read lock (implementation function)
 
int rwlock_wrunlock_impl (rwlock_t *rwlock)
 Release a write lock (implementation function)
 
uintptr_t asciichat_thread_to_key (asciichat_thread_t thread)
 Convert a thread handle to a registry key.
 
uint64_t asciichat_thread_current_id (void)
 Get the current thread's unique numeric ID.
 
int ascii_tls_key_create (tls_key_t *key, void(*destructor)(void *))
 Create a thread-local storage key.
 
int ascii_tls_key_delete (tls_key_t key)
 Delete a thread-local storage key.
 
void * ascii_tls_get (tls_key_t key)
 Get thread-local value for a key.
 
int ascii_tls_set (tls_key_t key, void *value)
 Set thread-local value for a key.
 

Detailed Description

Threading abstraction for WASM/Emscripten using pthreads.

Definition in file threading.c.