MCPcopy Index your code
hub / github.com/RT-Thread/rt-thread / rt_thread_self

Function rt_thread_self

src/thread.c:376–394  ·  view source on GitHub ↗

* @brief This function will return self thread object. * * @return The self thread object. If returns `RT_NULL`, it means that the * scheduler has not started yet. */

Source from the content-addressed store, hash-verified

374 * scheduler has not started yet.
375 */
376rt_thread_t rt_thread_self(void)
377{
378#ifndef RT_USING_SMP
379 return rt_cpu_self()->current_thread;
380
381#elif defined (ARCH_USING_HW_THREAD_SELF)
382 return rt_hw_thread_self();
383
384#else /* !ARCH_USING_HW_THREAD_SELF */
385 rt_thread_t self;
386 rt_base_t lock;
387
388 lock = rt_hw_local_irq_disable();
389 self = rt_cpu_self()->current_thread;
390 rt_hw_local_irq_enable(lock);
391
392 return self;
393#endif /* ARCH_USING_HW_THREAD_SELF */
394}
395RTM_EXPORT(rt_thread_self);
396
397/**

Callers 15

rt_mprotect_add_regionFunction · 0.85
lwp_exitFunction · 0.85
lwp_thread_exitFunction · 0.85
lwp_waitpidFunction · 0.85
lwp_check_exit_requestFunction · 0.85
lwp_terminateFunction · 0.85
_notify_parentFunction · 0.85

Calls 2

rt_hw_thread_selfFunction · 0.85
rt_cpu_selfFunction · 0.70

Tested by 15

sys_run_dirFunction · 0.68
gpio_output_testFunction · 0.68
gpio_input_testFunction · 0.68
usbd_testFunction · 0.68
sys_run_dirFunction · 0.68
gpio_output_testFunction · 0.68
gpio_input_testFunction · 0.68
usbd_testFunction · 0.68
sys_run_dirFunction · 0.68
gpio_output_testFunction · 0.68
gpio_input_testFunction · 0.68
usbd_testFunction · 0.68