| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- #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_UI,
- THREAD_ID_CELLULAR,
- THREAD_ID_RECV_MESSAGE_QUEUE,//进程间通信队列处理线程
- THREAD_ID_BROADCAST,
- THREAD_ID_MULCAST,
- 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
|