pthread-signal - example of how to use pthreads and signals
pthread-signal [OPTIONS] [THREAD_ARGS...]
pthread-signal(1) is a good template to begin with a new CLI in C, based on a basic skeleton using sigwaitinfo(3p) as main loop in main thread that propagates signals such as SIGTERM, SIGUSR1, SIGUSR2 to another thread.
-t or --timeout SEC Set timeout in sec [default=5]. Note: It is also used to wait for thread to join before returning.
-v or --verbose Turn on verbose messages.
-D or --debug Turn on debug messages.
-h or --help Display this message.
-V or --version Display the version.
SIGINT Cancel thread.
SIGTERM Signal thread using Terminate to cause thread to exit.
SIGUSR1 Signal thread using User signal 1.
SIGUSR2 Signal thread using User signal 2.
Written by Gaël PORTAY [email protected]
Copyright (C) 2018 Gaël PORTAY
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2.1 of the License, or (at your option) any later version.
pthreads(7)