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

Function _thread_timeout

src/thread.c:146–174  ·  view source on GitHub ↗

* @brief This function is the timeout function for thread, normally which is invoked * when thread is timeout to wait some resource. * * @param parameter is the parameter of thread timeout function */

Source from the content-addressed store, hash-verified

144 * @param parameter is the parameter of thread timeout function
145 */
146static void _thread_timeout(void *parameter)
147{
148 struct rt_thread *thread;
149 rt_sched_lock_level_t slvl;
150
151 thread = (struct rt_thread *)parameter;
152
153 /* parameter check */
154 RT_ASSERT(thread != RT_NULL);
155 RT_ASSERT(rt_object_get_type((rt_object_t)thread) == RT_Object_Class_Thread);
156
157 rt_sched_lock(&slvl);
158
159 /**
160 * resume of the thread and stop of the thread timer should be an atomic
161 * operation. So we don't expected that thread had resumed.
162 */
163 RT_ASSERT(rt_sched_thread_is_suspended(thread));
164
165 /* set error number */
166 thread->error = -RT_ETIMEOUT;
167
168 /* remove from suspend list */
169 rt_list_remove(&RT_THREAD_LIST_NODE(thread));
170 /* insert to schedule ready list */
171 rt_sched_insert_thread(thread);
172 /* do schedule and release the scheduler lock */
173 rt_sched_unlock_n_resched(slvl);
174}
175
176static rt_err_t _thread_init(struct rt_thread *thread,
177 const char *name,

Callers

nothing calls this directly

Calls 6

rt_object_get_typeFunction · 0.85
rt_list_removeFunction · 0.85
rt_sched_lockFunction · 0.70
rt_sched_insert_threadFunction · 0.70

Tested by

no test coverage detected