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

Function rt_thread_wakeup

src/thread.c:1136–1159  ·  view source on GitHub ↗

* This function will wakeup a thread with customized operation. * * @param thread the thread to be resumed * * @return the operation status, RT_EOK on OK, -RT_ERROR on error */

Source from the content-addressed store, hash-verified

1134 * @return the operation status, RT_EOK on OK, -RT_ERROR on error
1135 */
1136rt_err_t rt_thread_wakeup(rt_thread_t thread)
1137{
1138 rt_sched_lock_level_t slvl;
1139 rt_err_t ret;
1140 rt_wakeup_func_t func = RT_NULL;
1141
1142 RT_ASSERT(thread != RT_NULL);
1143 RT_ASSERT(rt_object_get_type((rt_object_t)thread) == RT_Object_Class_Thread);
1144
1145 rt_sched_lock(&slvl);
1146 func = thread->wakeup_handle.func;
1147 thread->wakeup_handle.func = RT_NULL;
1148 rt_sched_unlock(slvl);
1149
1150 if (func)
1151 {
1152 ret = func(thread->wakeup_handle.user_data, thread);
1153 }
1154 else
1155 {
1156 ret = rt_thread_resume(thread);
1157 }
1158 return ret;
1159}
1160RTM_EXPORT(rt_thread_wakeup);
1161
1162void rt_thread_wakeup_set(struct rt_thread *thread, rt_wakeup_func_t func, void* user_data)

Callers 5

_wait_sibling_exitFunction · 0.85
_do_signal_wakeupFunction · 0.85
_signal_deliverFunction · 0.85

Calls 4

rt_object_get_typeFunction · 0.85
rt_thread_resumeFunction · 0.85
rt_sched_lockFunction · 0.70
rt_sched_unlockFunction · 0.70

Tested by

no test coverage detected