This repository has been archived on 2026-04-17. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
bhlib-old/include/bh/internal/thread_posix.h

47 lines
814 B
C
Raw Normal View History

2024-04-14 22:32:58 +03:00
#include <pthread.h>
#include <semaphore.h>
2024-04-14 22:32:58 +03:00
struct bh_thread_s
{
pthread_t handle;
int allocated;
2024-04-14 22:32:58 +03:00
};
struct bh_mutex_s
{
pthread_mutex_t handle;
};
struct bh_semaphore_s
{
sem_t handle;
};
2024-04-14 22:32:58 +03:00
struct bh_cond_s
{
pthread_cond_t handle;
};
struct bh_spinlock_s
{
int handle;
};
2024-04-14 22:32:58 +03:00
int bh_thread_init(bh_thread_t *thread,
bh_task_t *task);
int bh_mutex_init(bh_mutex_t *mutex);
void bh_mutex_destroy(bh_mutex_t *mutex);
int bh_semaphore_init(bh_semaphore_t *semaphore,
int count);
void bh_semaphore_destroy(bh_semaphore_t *semaphore);
2024-04-14 22:32:58 +03:00
int bh_cond_init(bh_cond_t *cond);
void bh_cond_destroy(bh_cond_t *cond);
int bh_thread_pool_init(bh_thread_pool_t *pool,
size_t size);
void bh_thread_pool_destroy(bh_thread_pool_t *pool);