| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- #ifndef __THREAD_Hx__
- #define __THREAD_Hx__
- #include <pthread.h>
- #include <stdio.h>
- #ifdef __cplusplus
- extern "C" {
- #endif
- #define KB 1024
- #define MB (1024*1024)
- enum {
- THREAD_ID_IO=0,
- THREAD_ID_WS,
- THREAD_ID_WEB,
- THREAD_ID_NTP,
- THREAD_ID_SNMP,
- THREAD_ID_POWER,
- THREAD_ID_SENSOR,
- THREAD_ID_POLLING,
- THREAD_ID_CASCADE,
- THREAD_ID_SCAN,
- THREAD_ID_SHMW,
- THREAD_ID_BREAKER,
- THREAD_ID_SWITCH,
- THREAD_ID_BREAKER_SCANNER,
- THREAD_ID_MQTT,
- THREAD_ID_SMTP,
- THREAD_ID_TCP,
- THREAD_ID_MAX=30
- };
- typedef void *(*thread_fn)(void *arg);
- typedef struct {
- pthread_t tid;
- int quit;
- void *arg;
- thread_fn fn;
- void *stk;
- }thread_handle_t;
- int thread_start(int id, thread_fn fn, void *arg, int stksize, int prio);
- int thread_stop(int id);
- int thread_stop_all(void);
- int thread_start_simp(thread_fn fn, void *arg, int stksize);
- int thread_print_stacksize(void);
- #ifdef __cplusplus
- }
- #endif
- #endif
|