| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- #ifndef __THREAD_Hx__
- #define __THREAD_Hx__
- #include <pthread.h>
- #include <stdio.h>
- #include "log.h"
- #ifdef __cplusplus
- extern "C" {
- #endif
- #define KB 1024
- #define MB (KB*KB)
- enum {
- THREAD_ID_WEB=0,
- THREAD_ID_SNMP,
- THREAD_ID_POWER,
- THREAD_ID_POLL,
- THREAD_ID_MQTT,
- THREAD_ID_MAIL,
- THREAD_ID_UI,
- THREAD_ID_CAS_SCAN,
- THREAD_ID_CAS_TH,
-
- THREAD_ID_MAX
- };
- typedef void (*thread_fn_t)(void *arg);
- typedef struct {
- const char *name;
- thread_fn_t fn;
- void *arg;
- int stksz;
- int prio;
- }thread_attr_t;
- typedef struct {
- pthread_t tid;
- int quit;
- int running;
- thread_attr_t *attr;
- }thread_handle_t;
- int thread_start(int id, thread_fn_t fn, void *arg);
- int thread_start2(int id);
- int thread_restart(int id);
- int thread_startEx(int id, thread_attr_t *attr);
- int thread_stop(int id);
- int thread_stop_all(void);
- int thread_is_running(int id);
- int thread_start_simp(thread_fn_t fn, void *arg, int stksz);
- int thread_print_stacksize(void);
- #ifdef __cplusplus
- }
- #endif
- #endif
|