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

Function lwp_tid_set_thread

components/lwp/lwp_tid.c:248–260  ·  view source on GitHub ↗

* @brief Associate a thread with a given TID in the thread ID management system * * @param[in] tid The thread ID to associate with the thread * @param[in] thread The thread object to be associated with the TID * * @note This function safely associates a thread object with a specified thread ID (TID) * in the system's AVL tree. The operation is protected by a mutex to ensure thread safe

Source from the content-addressed store, hash-verified

246 * in the system's AVL tree. The operation is protected by a mutex to ensure thread safety.
247 */
248void lwp_tid_set_thread(int tid, rt_thread_t thread)
249{
250 struct lwp_avl_struct *p;
251
252 lwp_mutex_take_safe(&tid_lock, RT_WAITING_FOREVER, 0);
253 p = lwp_avl_find(tid, lwp_tid_root);
254 if (p)
255 {
256 RT_ASSERT(p->data == RT_NULL);
257 p->data = thread;
258 }
259 lwp_mutex_release_safe(&tid_lock);
260}

Callers 4

lwp_execveFunction · 0.85
sys_thread_createFunction · 0.85
_sys_cloneFunction · 0.85
_sys_forkFunction · 0.85

Calls 3

lwp_mutex_take_safeFunction · 0.85
lwp_avl_findFunction · 0.85
lwp_mutex_release_safeFunction · 0.85

Tested by

no test coverage detected