I feel this function name should be more explicit.
That is, it should avoid confusion between read and write operations.
}
#endif // _di_f_thread_sets_resize_
-#ifndef _di_f_thread_signal_
- f_status_t f_thread_signal(const f_thread_id_t id, const int signal) {
+#ifndef _di_f_thread_signal_mask_
+ f_status_t f_thread_signal_mask(const int how, const sigset_t *next, sigset_t * const current) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!next && !current) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (pthread_sigmask(how, next, current) < 0) {
+ if (errno == EFAULT) return F_status_set_error(F_buffer);
+ if (errno == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+
+ return F_none;
+ }
+#endif // _di_f_thread_signal_mask_
+
+#ifndef _di_f_thread_signal_write_
+ f_status_t f_thread_signal_write(const f_thread_id_t id, const int signal) {
const int error = pthread_kill(id, signal);
return F_found;
}
-#endif // _di_f_thread_signal_
-
-#ifndef _di_f_thread_signal_mask_
- f_status_t f_thread_signal_mask(const int how, const sigset_t *next, sigset_t * const current) {
- #ifndef _di_level_0_parameter_checking_
- if (!next && !current) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- if (pthread_sigmask(how, next, current) < 0) {
- if (errno == EFAULT) return F_status_set_error(F_buffer);
- if (errno == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- return F_none;
- }
-#endif // _di_f_thread_signal_mask_
+#endif // _di_f_thread_signal_write_
#if defined(_pthread_sigqueue_unsupported_) && !defined(_di_f_thread_signal_queue_)
f_status_t f_thread_signal_queue(const f_thread_id_t id, const int signal, const union sigval value) {
#endif // _di_f_thread_sets_resize_
/**
- * Send a signal to the given thread.
- *
- * @param id
- * The ID of the thread to signal.
- * @param signal
- * The signal to send to the thread.
- * If 0 is used instead of a valid signal, then instead check to see if the thread exists.
- *
- * @return
- * F_none on success and signal is not 0.
- * F_found on success, signal is 0, and the thread by the given ID does exist.
- *
- * F_found_not on success, signal is 0, and the thread by the given ID does not exist.
- * F_found_not (with error bit) if no thread by the given ID was found (and signal is not 0).
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * @see pthread_kill()
- */
-#ifndef _di_f_thread_signal_
- extern f_status_t f_thread_signal(const f_thread_id_t id, const int signal);
-#endif // _di_f_thread_signal_
-
-/**
* Get or assign the current signal set in use.
*
* Either set or previous may be NULL but not both (at least one is required).
#endif // _di_f_thread_signal_mask_
/**
+ * Send a signal to the given thread.
+ *
+ * @param id
+ * The ID of the thread to signal.
+ * @param signal
+ * The signal to send to the thread.
+ * If 0 is used instead of a valid signal, then instead check to see if the thread exists.
+ *
+ * @return
+ * F_none on success and signal is not 0.
+ * F_found on success, signal is 0, and the thread by the given ID does exist.
+ *
+ * F_found_not on success, signal is 0, and the thread by the given ID does not exist.
+ * F_found_not (with error bit) if no thread by the given ID was found (and signal is not 0).
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * @see pthread_kill()
+ */
+#ifndef _di_f_thread_signal_write_
+ extern f_status_t f_thread_signal_write(const f_thread_id_t id, const int signal);
+#endif // _di_f_thread_signal_write_
+
+/**
* Send the signal and value to the given thread.
*
* @param id
void controller_process_delete_simple(controller_process_t * const process) {
if (process->id_thread) {
- f_thread_signal(process->id_thread, F_signal_kill);
+ f_thread_signal_write(process->id_thread, F_signal_kill);
f_thread_join(process->id_thread, 0);
process->id_thread = 0;
do {
if (!process->id_thread) break;
- f_thread_signal(process->id_thread, global.thread->signal ? global.thread->signal : F_signal_termination);
+ f_thread_signal_write(process->id_thread, global.thread->signal ? global.thread->signal : F_signal_termination);
controller_time(0, controller_thread_exit_process_cancel_wait_d, &time);