|
|
@@ -1,23 +1,23 @@
|
|
|
#include "thread.h"
|
|
|
|
|
|
static thread_attr_t thdAttrs[THREAD_ID_MAX]={
|
|
|
- //name fn stacksize prio
|
|
|
- {"io", NULL, 8*MB, 1},
|
|
|
- {"ws", ws_thread, 8*MB, 1},
|
|
|
- {"web", web_thread, 8*MB, 1},
|
|
|
- {"ntp", ntp_thread, 8*MB, 1},
|
|
|
- {"snmp", snmp_thread, 8*MB, 1},
|
|
|
- {"power", power_thread, 8*MB, 1},
|
|
|
- {"sensor", sensor_thread, 8*MB, 1},
|
|
|
- {"polling", polling_thread, 8*MB, 1},
|
|
|
- {"cascade", cascade_thread, 8*MB, 1},
|
|
|
- {"casscan", cascade_scan_thread, 8*MB, 1},
|
|
|
- {"shmw", shm_thread, 8*MB, 1},
|
|
|
- {"breaker", breaker_thread, 8*MB, 1},
|
|
|
- {"switch", netswitch_thread, 8*MB, 1},
|
|
|
- {"brkscan", breaker_scanner_thread, 8*MB, 1},
|
|
|
- {"mqtt", mqtt_thread, 8*MB, 1},
|
|
|
- {"smtp", smtp_thread, 8*MB, 1},
|
|
|
+ //name fn arg stacksize prio
|
|
|
+ {"io", NULL, NULL, 8*MB, 1},
|
|
|
+ {"ws", ws_thread, NULL, 8*MB, 1},
|
|
|
+ {"web", web_thread, NULL, 8*MB, 1},
|
|
|
+ {"ntp", ntp_thread, NULL, 8*MB, 1},
|
|
|
+ {"snmp", snmp_thread, NULL, 8*MB, 1},
|
|
|
+ {"power", power_thread, NULL, 8*MB, 1},
|
|
|
+ {"sensor", sensor_thread, NULL, 8*MB, 1},
|
|
|
+ {"polling", polling_thread, NULL, 8*MB, 1},
|
|
|
+ {"cascade", cascade_thread, NULL, 8*MB, 1},
|
|
|
+ {"casscan", cascade_scan_thread, NULL, 8*MB, 1},
|
|
|
+ {"shmw", shm_thread, NULL, 8*MB, 1},
|
|
|
+ {"breaker", breaker_thread, NULL, 8*MB, 1},
|
|
|
+ {"switch", netswitch_thread, NULL, 8*MB, 1},
|
|
|
+ {"brkscan", breaker_scanner_thread, NULL, 8*MB, 1},
|
|
|
+ {"mqtt", mqtt_thread, NULL, 8*MB, 1},
|
|
|
+ {"smtp", smtp_thread, NULL, 8*MB, 1},
|
|
|
};
|
|
|
static thread_handle_t thdHandles[THREAD_ID_MAX]={0};
|
|
|
|
|
|
@@ -29,9 +29,22 @@ int thread_start(int id, void *arg)
|
|
|
}
|
|
|
thread_attr_t *attr=&thdAttrs[id];
|
|
|
|
|
|
- return thread_startEx(id, attr->name, attr->fn, arg, attr->stksz, attr->prio);
|
|
|
+ attr->arg = arg;
|
|
|
+ return thread_startEx(id, attr->name, attr->fn, attr->arg, attr->stksz, attr->prio);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+int thread_restart(int id)
|
|
|
+{
|
|
|
+ if(id<0 || id>=THREAD_ID_MAX) {
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+ thread_attr_t *attr=&thdAttrs[id];
|
|
|
+
|
|
|
+ return thread_startEx(id, attr->name, attr->fn, attr->arg, attr->stksz, attr->prio);
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
int thread_startEx(int id, const char *name, thread_fn fn, void *arg, int stksz, int prio)
|
|
|
{
|
|
|
int r;
|