blob: 77dc2d562236bb36ae5c555443589c1ebf13db35 [file] [log] [blame]
rjw1f884582022-01-06 17:20:42 +08001#ifndef __SYN_PRIMITIVE__H_
2#define __SYN_PRIMITIVE__H_
3
4#include <pthread.h>
5#include <semaphore.h>
6#include "typedefs.h"
7#include <string.h>
8#include <stdio.h>
9#include <stdlib.h>
10#include "liblog/liblog.h"
11#include "liblog/lynq_deflog.h"
12
13typedef pthread_t thread_id;
14typedef pthread_t thread_handle;
15typedef pthread_cond_t condition_handle;
16typedef pthread_mutex_t mutex_handle;
17typedef sem_t sem_handle;
18
19
20
21#define TIME_WAIT_INFINITE 0x7fffffff
22
23
24
25int init_condition_handle(condition_handle *cond);
26int destroy_condition_handle(condition_handle *cond);
27//int wait_condition(condition_handle *cond, mutex_handle *mutex);
28int wait_condition(condition_handle *cond, mutex_handle *mutex, unsigned int wait);
29int post_condition_signal(condition_handle *cond);
30int init_mutex_handle(mutex_handle *mutex);
31int mutex_lock(mutex_handle *mutex);
32int mutex_unlock(mutex_handle *mutex);
33int mutex_destroy(mutex_handle *mutex);
34int create_sem(sem_handle *sem, int init_count);
35int wait_sem(sem_handle *sem);
36int post_sem(sem_handle *sem);
37int destroy_sem(sem_handle *sem);
38
39
40
41#endif //__SYN_PRIMITIVE__H_
42
43