aboutsummaryrefslogtreecommitdiff
path: root/doc/man3
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi.dcr@tutanota.com>2024-08-20 00:07:05 +0200
committerXavier Del Campo Romero <xavi.dcr@tutanota.com>2024-08-22 02:27:34 +0200
commit43e89fb23943b5ffb6854f290592c29cd079bf46 (patch)
tree3a295c16aebdcbea5ce733fe61ba8ba639bc4f41 /doc/man3
parent34b62bd0c47c915a12ff1b81f52b123fc3eb4a69 (diff)
Move signal handling to processes
So far, libweb installed a signal handler so as to handle SIGTERM, SIGPIPE and SIGINT signals so that processes would not have to care about such details. However, it is not advisable for libraries to install signal handlers, as signals are handled on a per-process basis. The previous approach would be incompatible if several instances of the library were allocated by the same process. Unfortunately, this has the undesired side effect of adding the boilerplate code into the process.
Diffstat (limited to 'doc/man3')
-rw-r--r--doc/man3/handler_notify_close.351
1 files changed, 51 insertions, 0 deletions
diff --git a/doc/man3/handler_notify_close.3 b/doc/man3/handler_notify_close.3
new file mode 100644
index 0000000..3cc4130
--- /dev/null
+++ b/doc/man3/handler_notify_close.3
@@ -0,0 +1,51 @@
+.TH HANDLER_NOTIFY_CLOSE 3 2024-07-13 0.4.0 "libweb Library Reference"
+
+.SH NAME
+handler_notify_close \- tell a web server handler object to close gracefully
+
+.SH SYNOPSIS
+.LP
+.nf
+#include <libweb/handler.h>
+.P
+int handler_notify_close(struct handler *\fIh\fP);
+.fi
+
+.SH DESCRIPTION
+The
+.IR handler_notify_close (3)
+function notifies
+.I h
+to exit the loop entered to by
+.IR handler_loop (3).
+.IR h
+must have been returned by a previous call to
+.IR handler_alloc (3).
+
+This function is
+.IR async-signal-safe ,
+so it can be safely called from a signal handler. This is intentional,
+as applications would typically want to close the server on specific
+signals, such as
+.I SIGINT
+or
+.IR SIGTERM .
+
+.SH RETURN VALUE
+On success, zero is returned. On error, a negative integer is returned.
+
+.SH ERRORS
+No errors are defined.
+
+.SH SEE ALSO
+.BR handler_alloc (3),
+.BR handler_loop (3),
+.BR libweb_handler (7).
+
+.SH COPYRIGHT
+Copyright (C) 2023-2024 libweb contributors
+.P
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU Affero General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.