* @brief Sends a signal to a specific thread. * * The `pthread_kill` function sends the specified signal to the target thread. This allows fine-grained * control over signal handling in multithreaded applications. * * @param[in] thread * The target thread to which the signal is sent. This is a valid `pthread_t` identifier. * * @param[in] sig * The signal to be sent. This can be any va
| 1091 | * @see pthread_sigmask, sigaction |
| 1092 | */ |
| 1093 | int pthread_kill(pthread_t thread, int sig) |
| 1094 | { |
| 1095 | #ifdef RT_USING_SIGNALS |
| 1096 | _pthread_data_t *ptd; |
| 1097 | int ret; |
| 1098 | |
| 1099 | ptd = _pthread_get_data(thread); |
| 1100 | if (ptd) |
| 1101 | { |
| 1102 | ret = rt_thread_kill(ptd->tid, sig); |
| 1103 | if (ret == -RT_EINVAL) |
| 1104 | { |
| 1105 | return EINVAL; |
| 1106 | } |
| 1107 | |
| 1108 | return ret; |
| 1109 | } |
| 1110 | |
| 1111 | return ESRCH; |
| 1112 | #else |
| 1113 | return ENOSYS; |
| 1114 | #endif |
| 1115 | } |
| 1116 | RTM_EXPORT(pthread_kill); |
| 1117 | |
| 1118 | #ifdef RT_USING_SIGNALS |
no test coverage detected