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

Function rt_thread_resume

src/thread.c:1089–1125  ·  view source on GitHub ↗

* @brief This function will resume a thread and put it to system ready queue. * * @param thread Handle of the thread to be resumed. * * @return Return the operation status. If the return value is `RT_EOK`, the * function is successfully executed. * If the return value is any other values, it means this operation failed. */

Source from the content-addressed store, hash-verified

1087 * If the return value is any other values, it means this operation failed.
1088 */
1089rt_err_t rt_thread_resume(rt_thread_t thread)
1090{
1091 rt_sched_lock_level_t slvl;
1092 rt_err_t error;
1093
1094 /* parameter check */
1095 RT_ASSERT(thread != RT_NULL);
1096 RT_ASSERT(rt_object_get_type((rt_object_t)thread) == RT_Object_Class_Thread);
1097
1098 LOG_D("thread resume: %s", thread->parent.name);
1099
1100 rt_sched_lock(&slvl);
1101
1102 error = rt_sched_thread_ready(thread);
1103
1104 if (!error)
1105 {
1106 error = rt_sched_unlock_n_resched(slvl);
1107
1108 /**
1109 * RT_ESCHEDLOCKED indicates that the current thread is in a critical section,
1110 * rather than 'thread' can't be resumed. Therefore, we can ignore this error.
1111 */
1112 if (error == -RT_ESCHEDLOCKED)
1113 {
1114 error = RT_EOK;
1115 }
1116 }
1117 else
1118 {
1119 rt_sched_unlock(slvl);
1120 }
1121
1122 RT_OBJECT_HOOK_CALL(rt_thread_resume_hook, (thread));
1123
1124 return error;
1125}
1126RTM_EXPORT(rt_thread_resume);
1127
1128#ifdef RT_USING_SMART

Callers 15

lwp_tid_dec_refFunction · 0.85
wakeup_sender_wait_recvFunction · 0.85
wakeup_sender_wait_replyFunction · 0.85
rt_raw_channel_replyFunction · 0.85
rt_wqueue_wakeupFunction · 0.85
rt_wqueue_wakeup_allFunction · 0.85
rt_wm_que_decFunction · 0.85

Calls 5

rt_object_get_typeFunction · 0.85
rt_sched_thread_readyFunction · 0.85
rt_sched_lockFunction · 0.70
rt_sched_unlockFunction · 0.70