rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | #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 |
|
| 13 | typedef pthread_t thread_id;
|
| 14 | typedef pthread_t thread_handle;
|
| 15 | typedef pthread_cond_t condition_handle;
|
| 16 | typedef pthread_mutex_t mutex_handle;
|
| 17 | typedef sem_t sem_handle;
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 | #define TIME_WAIT_INFINITE 0x7fffffff
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 | int init_condition_handle(condition_handle *cond);
|
| 26 | int destroy_condition_handle(condition_handle *cond);
|
| 27 | //int wait_condition(condition_handle *cond, mutex_handle *mutex);
|
| 28 | int wait_condition(condition_handle *cond, mutex_handle *mutex, unsigned int wait);
|
| 29 | int post_condition_signal(condition_handle *cond);
|
| 30 | int init_mutex_handle(mutex_handle *mutex);
|
| 31 | int mutex_lock(mutex_handle *mutex);
|
| 32 | int mutex_unlock(mutex_handle *mutex);
|
| 33 | int mutex_destroy(mutex_handle *mutex);
|
| 34 | int create_sem(sem_handle *sem, int init_count);
|
| 35 | int wait_sem(sem_handle *sem);
|
| 36 | int post_sem(sem_handle *sem);
|
| 37 | int destroy_sem(sem_handle *sem);
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 | #endif //__SYN_PRIMITIVE__H_
|
| 42 |
|
| 43 |
|