Haka
Macros | Typedefs | Enumerations | Functions
thread.h File Reference
#include <stddef.h>
#include <errno.h>
#include <pthread.h>
#include <semaphore.h>
#include <haka/types.h>
#include <haka/compiler.h>

Go to the source code of this file.

Macros

#define THREAD_CANCELED   PTHREAD_CANCELED
 
#define MUTEX_INIT   PTHREAD_MUTEX_INITIALIZER
 
#define RWLOCK_INIT   PTHREAD_RWLOCK_INITIALIZER
 

Typedefs

typedef pthread_t thread_t
 
typedef pthread_mutex_t mutex_t
 
typedef pthread_spinlock_t spinlock_t
 
typedef pthread_rwlock_t rwlock_t
 
typedef sem_t semaphore_t
 
typedef pthread_barrier_t barrier_t
 
typedef pthread_key_t local_storage_t
 
typedef volatile uint32 atomic_t
 
typedef volatile uint64 atomic64_t
 

Enumerations

Functions

int thread_get_packet_capture_cpu_count ()
 
void thread_set_packet_capture_cpu_count (int count)
 
int thread_get_cpu_count ()
 
bool thread_create (thread_t *thread, void *(*main)(void *), void *param)
 
thread_t thread_current ()
 
bool thread_join (thread_t thread, void **ret)
 
bool thread_cancel (thread_t thread)
 
int thread_getid ()
 
void thread_setid (int id)
 
bool thread_sigmask (int how, sigset_t *set, sigset_t *oldset)
 
bool thread_signal (thread_t thread, int sig)
 
bool thread_setcancelstate (bool enable)
 
bool thread_setcanceltype (enum thread_cancel_t type)
 
void thread_testcancel ()
 
void thread_protect (void(*run)(void *), void *runarg, void(*finish)(void *), void *finisharg)
 
thread_t thread_main ()
 
thread_t thread_self ()
 
bool thread_equal (thread_t a, thread_t b)
 
bool thread_kill (thread_t thread, int sig)
 
bool local_storage_init (local_storage_t *key, void(*destructor)(void *))
 
bool local_storage_destroy (local_storage_t *key)
 
void * local_storage_get (local_storage_t *key)
 
bool local_storage_set (local_storage_t *key, const void *value)
 
INLINE uint32 atomic_inc (atomic_t *v)
 
INLINE uint32 atomic_dec (atomic_t *v)
 
INLINE uint32 atomic_get (atomic_t *v)
 
INLINE void atomic_set (atomic_t *v, uint32 x)
 
INLINE void atomic64_set (atomic64_t *v, uint64 x)
 
INLINE void atomic64_init (atomic64_t *v, uint64 x)
 
INLINE void atomic64_destroy (atomic64_t *v)
 
INLINE uint64 atomic64_inc (atomic64_t *v)
 
INLINE uint64 atomic64_dec (atomic64_t *v)
 
INLINE uint64 atomic64_get (atomic64_t *v)
 

Detailed Description

Thread utilities functions.