+/** Tells if a process is active (i.e., added). **/
+static inline int process_is_active(struct main_process *mp)
+{
+ return clist_is_linked(&mp->n);
+}
+
+/** Show current state of a process. Available only if LibUCW has been compiled with `CONFIG_UCW_DEBUG`. **/
+void process_debug(struct main_process *pr);
+
+/***
+ * [[signal]]
+ * Synchronous delivery of signals
+ * -------------------------------
+ *
+ * UNIX signals are delivered to processes in an asynchronous way: when a signal
+ * arrives (and it is not blocked), the process is interrupted and the corresponding
+ * signal handler function is called. However, most data structures and even most
+ * system library calls are not safe with respect to interrupts, so most program
+ * using signals contain subtle race conditions and may fail once in a long while.
+ *
+ * To avoid this problem, the event loop can be asked for synchronous delivery
+ * of signals. When a signal registered with @signal_add() arrives, it wakes up
+ * the loop (if it is not already awake) and it is processed in the same way
+ * as all other events.
+ *
+ * When used in a multi-threaded program, the signals are delivered to the thread
+ * which is currently using the particular main loop context. If the context is not
+ * current in any thread, the signals are blocked.
+ *
+ * As usually with UNIX signals, multiple instances of a single signal can be
+ * merged and delivered only once. (Some implementations of the main loop can even
+ * drop a signal completely during very intensive signal traffic, when an internal
+ * signal queue overflows.)
+ ***/
+
+/** Description of a signal to catch. **/
+struct main_signal {
+ cnode n;
+ int signum; /* [*] Signal to catch */
+ void (*handler)(struct main_signal *ms); /* [*] Called when the signal arrives */
+ void *data; /* [*] For use by the handler */
+};
+
+/** Request a signal to be caught and delivered synchronously. **/
+void signal_add(struct main_signal *ms);
+
+/** Cancel a request for signal catching. Calling twice is safe. **/
+void signal_del(struct main_signal *ms);
+
+/** Tells if a signal catcher is active (i.e., added). **/
+static inline int signal_is_active(struct main_signal *ms)
+{
+ return clist_is_linked(&ms->n);
+}
+
+/** Show current state of a signal catcher. Available only if LibUCW has been compiled with `CONFIG_UCW_DEBUG`. **/
+void signal_debug(struct main_signal *sg);
+