MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / lwp_teardown

Function lwp_teardown

components/lwp/lwp_runtime.c:140–161  ·  view source on GitHub ↗

reverse operation of lwp_startup() */

Source from the content-addressed store, hash-verified

138
139/* reverse operation of lwp_startup() */
140sysret_t lwp_teardown(struct rt_lwp *lwp, void (*cb)(void))
141{
142 struct rt_work *work;
143
144 if (lwp->pid != INIT_PID && _get_parent_pid(lwp) != INIT_PID)
145 {
146 /* The calling process has insufficient privilege */
147 return -EPERM;
148 }
149
150 work = &_teardown_work;
151 rt_work_init(work, _teardown_entry, cb);
152
153#define SOME_DELAY (RT_TICK_PER_SECOND / 10) /* allow idle to cleanup resource */
154 rt_work_submit(work, SOME_DELAY);
155
156 lwp_exit(lwp, LWP_CREATE_STAT_EXIT(EXIT_SUCCESS));
157
158 /* never return */
159 RT_ASSERT(0);
160 return 0;
161}

Callers

nothing calls this directly

Calls 4

_get_parent_pidFunction · 0.85
rt_work_initFunction · 0.85
rt_work_submitFunction · 0.85
lwp_exitFunction · 0.85

Tested by

no test coverage detected