reverse operation of lwp_startup() */
| 138 | |
| 139 | /* reverse operation of lwp_startup() */ |
| 140 | sysret_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 | } |
nothing calls this directly
no test coverage detected