* @brief Clean up resources associated with a light-weight process thread * * @param[in] tid Pointer to the thread control block to be cleaned up * * @note This function performs cleanup operations for a thread associated with a light-weight process (LWP). * It handles signal detachment and reference count decrement for the LWP structure. * */
| 217 | * |
| 218 | */ |
| 219 | void lwp_cleanup(struct rt_thread *tid) |
| 220 | { |
| 221 | struct rt_lwp *lwp; |
| 222 | |
| 223 | if (tid == NULL) |
| 224 | { |
| 225 | LOG_I("%s: invalid parameter tid == NULL", __func__); |
| 226 | return; |
| 227 | } |
| 228 | else |
| 229 | LOG_D("cleanup thread: %s, stack_addr: 0x%x", tid->parent.name, tid->stack_addr); |
| 230 | |
| 231 | /** |
| 232 | * Brief: lwp thread cleanup |
| 233 | * |
| 234 | * Note: Critical Section |
| 235 | * - thread control block (RW. It's ensured that no one else can access tcb |
| 236 | * other than itself) |
| 237 | */ |
| 238 | lwp = (struct rt_lwp *)tid->lwp; |
| 239 | lwp_thread_signal_detach(&tid->signal); |
| 240 | |
| 241 | /* tty will be release in lwp_ref_dec() if ref is cleared */ |
| 242 | lwp_ref_dec(lwp); |
| 243 | return; |
| 244 | } |
| 245 | |
| 246 | /** |
| 247 | * @brief Set up standard I/O for a light-weight process |
nothing calls this directly
no test coverage detected