* @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
| 246 | * in the system's AVL tree. The operation is protected by a mutex to ensure thread safety. |
| 247 | */ |
| 248 | void 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 | } |
no test coverage detected