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

Function lwp_cleanup

components/lwp/lwp.c:219–244  ·  view source on GitHub ↗

* @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. * */

Source from the content-addressed store, hash-verified

217 *
218 */
219void 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

Callers

nothing calls this directly

Calls 2

lwp_thread_signal_detachFunction · 0.85
lwp_ref_decFunction · 0.85

Tested by

no test coverage detected