| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- #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_CASCADE_SCAN,
- THREAD_ID_SHMW,
- THREAD_ID_BREAKER,
- THREAD_ID_SWITCH,
- THREAD_ID_BREAKER_SCANNER,
- THREAD_ID_MQTT,
- THREAD_ID_MAIL,
- THREAD_ID_TCP,
- THREAD_ID_BOARD, //board upgrade
-
- THREAD_ID_MAX
- };
- typedef void *(*thread_fn)(void *arg);
- typedef struct {
- const char *name;
- thread_fn fn;
- void *arg;
- int stksz;
- int prio;
- }thread_attr_t;
- typedef struct {
- const char *name;
- pthread_t tid;
- int quit;
- int running;
- void *arg;
- thread_fn fn;
- void *stk;
- }thread_handle_t;
- int thread_start(int id, thread_fn fn, void *arg);
- int thread_start2(int id);
- int thread_restart(int id);
- int thread_startEx(int id, const char *name, thread_fn fn, void *arg, int stksz, int prio);
- int thread_stop(int id);
- int thread_stop_all(void);
- int thread_is_running(int id);
- int thread_start_simp(thread_fn fn, void *arg, int stksz);
- int thread_print_stacksize(void);
- #ifdef __cplusplus
- }
- #endif
- #endif
|