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

Function sys_tkill

components/lwp/lwp_syscall.c:6767–6787  ·  view source on GitHub ↗

* @brief Sends a signal to a specific thread. * * This system call allows a process to send a signal to a specific thread within the same process. * The signal specified by the `sig` parameter will be delivered to the thread with the ID `tid`. * This function is similar to `kill()`, but it targets a specific thread rather than a process. * * @param[in] tid The thread ID to which the signal

Source from the content-addressed store, hash-verified

6765 * @see sys_kill(), sys_sigaction()
6766 */
6767sysret_t sys_tkill(int tid, int sig)
6768{
6769#ifdef ARCH_MM_MMU
6770 rt_thread_t thread;
6771 sysret_t ret;
6772
6773 /**
6774 * Brief: Match a tid and do the kill
6775 *
6776 * Note: Critical Section
6777 * - the thread (READ. may be released at the meantime; protected by locked)
6778 */
6779 thread = lwp_tid_get_thread_and_inc_ref(tid);
6780 ret = lwp_thread_signal_kill(thread, sig, SI_USER, 0);
6781 lwp_tid_dec_ref(thread);
6782
6783 return ret;
6784#else
6785 return lwp_thread_kill((rt_thread_t)tid, sig);
6786#endif
6787}
6788
6789/**
6790 * @brief Manipulates the signal mask for the current thread.

Callers

nothing calls this directly

Calls 3

lwp_thread_signal_killFunction · 0.85
lwp_tid_dec_refFunction · 0.85

Tested by

no test coverage detected