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

Function pthread_self

components/libc/posix/pthreads/pthread.c:665–678  ·  view source on GitHub ↗

* @brief Returns the thread ID of the calling thread. * * The `pthread_self` function returns the thread ID of the calling thread. The thread ID is unique to the * thread within a process and can be used to identify the calling thread in the context of multithreading. * * The value returned by `pthread_self` can be compared with the thread IDs of other threads to determine * if two threads a

Source from the content-addressed store, hash-verified

663 * @see pthread_create, pthread_equal, pthread_join
664 */
665pthread_t pthread_self (void)
666{
667 rt_thread_t tid;
668 _pthread_data_t *ptd;
669
670 tid = rt_thread_self();
671 if (tid == NULL) return PTHREAD_NUM_MAX;
672
673 /* get pthread data from pthread_data of thread */
674 ptd = (_pthread_data_t *)rt_thread_self()->pthread_data;
675 RT_ASSERT(ptd != RT_NULL);
676
677 return _pthread_data_get_pth(ptd);
678}
679RTM_EXPORT(pthread_self);
680
681/**

Callers 13

rt_hw_interrupt_enableFunction · 0.85
mainthread_schedulerFunction · 0.85
mthread_signal_tickFunction · 0.85
str_accumulateFunction · 0.85
str_alloc_keyFunction · 0.85
str_alloc_destroy_accuFunction · 0.85
processFunction · 0.85
libc_ex4Function · 0.85
print_itFunction · 0.85

Calls 2

rt_thread_selfFunction · 0.85
_pthread_data_get_pthFunction · 0.85

Tested by

no test coverage detected