* @brief This function is called when a thread exits. It can detach the thread and perform cleanup. * * @param status is the exit status of the thread. */
| 21 | * @param status is the exit status of the thread. |
| 22 | */ |
| 23 | void __rt_libc_exit(int status) |
| 24 | { |
| 25 | rt_thread_t self = rt_thread_self(); |
| 26 | |
| 27 | if (self != RT_NULL) |
| 28 | { |
| 29 | LOG_W("thread:%s exit:%d!", self->parent.name, status); |
| 30 | #ifdef RT_USING_PTHREADS |
| 31 | if (self->pthread_data != RT_NULL) |
| 32 | { |
| 33 | extern void pthread_exit(void *value); |
| 34 | pthread_exit((void *)status); |
| 35 | } |
| 36 | else |
| 37 | #endif |
| 38 | { |
| 39 | rt_thread_control(self, RT_THREAD_CTRL_CLOSE, RT_NULL); |
| 40 | } |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | #ifdef RT_USING_MSH |
| 45 | /** |
no test coverage detected