SSCMA-Micro CPP SDK  v2.0.0
SSCMA-Micro is a cross-platform machine learning inference framework designed for embedded devices.
ma_osal_pthread.h
Go to the documentation of this file.
1 #ifndef _MA_OSAL_PTHREAD_H_
2 #define _MA_OSAL_PTHREAD_H_
3 
4 #include "core/ma_common.h"
5 
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
9 
10 #include <csignal>
11 #include <pthread.h>
12 #include <time.h>
13 
14 #define MA_WAIT_FOREVER 0xFFFFFFFF
15 
16 typedef uint64_t ma_tick_t;
17 typedef pthread_t ma_thread_t;
18 typedef pthread_mutex_t ma_mutex_t;
19 typedef void* ma_stack_t;
20 
21 typedef struct ma_sem {
22  pthread_cond_t cond;
23  size_t count;
25 
26 typedef struct ma_event {
27  pthread_cond_t cond;
28  uint32_t value;
30 
31 typedef struct ma_mbox {
32  pthread_cond_t cond;
33  size_t r;
34  size_t w;
35  size_t count;
36  size_t size;
37  void* msg[64];
39 
40 typedef struct ma_timer {
41  timer_t timerid;
42  bool exit;
43  void (*fn)(struct ma_timer*, void* arg);
44  void* arg;
45  uint32_t ms;
46  bool oneshot;
48 
49 
50 #ifdef __cplusplus
51 }
52 #endif
53 
54 #endif // _MA_OSAL_PTHREAD_H_
struct ma_mbox ma_mbox_t
void * ma_stack_t
Definition: ma_osal_pthread.h:19
pthread_t ma_thread_t
Definition: ma_osal_pthread.h:17
pthread_mutex_t ma_mutex_t
Definition: ma_osal_pthread.h:18
struct ma_timer ma_timer_t
struct ma_event ma_event_t
struct ma_sem ma_sem_t
uint64_t ma_tick_t
Definition: ma_osal_pthread.h:16
Definition: ma_osal_pthread.h:26
pthread_cond_t cond
Definition: ma_osal_pthread.h:27
uint32_t value
Definition: ma_osal_pthread.h:28
Definition: ma_osal_pthread.h:31
size_t w
Definition: ma_osal_pthread.h:34
void * msg[64]
Definition: ma_osal_pthread.h:37
size_t size
Definition: ma_osal_pthread.h:36
size_t count
Definition: ma_osal_pthread.h:35
pthread_cond_t cond
Definition: ma_osal_pthread.h:32
size_t r
Definition: ma_osal_pthread.h:33
Definition: ma_osal_pthread.h:21
size_t count
Definition: ma_osal_pthread.h:23
pthread_cond_t cond
Definition: ma_osal_pthread.h:22
Definition: ma_osal_pthread.h:40
void(* fn)(struct ma_timer *, void *arg)
Definition: ma_osal_pthread.h:43
bool oneshot
Definition: ma_osal_pthread.h:46
timer_t timerid
Definition: ma_osal_pthread.h:41
bool exit
Definition: ma_osal_pthread.h:42
uint32_t ms
Definition: ma_osal_pthread.h:45
void * arg
Definition: ma_osal_pthread.h:44