aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/signal.c (unfollow)
Commit message (Collapse)Author
2023-06-14minor refactoringEgor Tensin
2023-06-13signal: remove the stupid add_to_event_loop wrapperEgor Tensin
2023-06-13signal: sigprocmask -> pthread_sigmaskEgor Tensin
2023-06-13signal: refactoringEgor Tensin
2023-06-13sanitize #include-sEgor Tensin
2023-06-13signal: remove unused APIsEgor Tensin
2023-06-13event_loop: hide the API detailsEgor Tensin
2023-06-13use signalfd to stop on SIGTERMEgor Tensin
Is this an overkill? I don't know. The thing is, correctly intercepting SIGTERM (also SIGINT, etc.) is incredibly tricky. For example, before this commit, my I/O loops in server.c and worker.c were inherently racy. This was immediately obvious if you tried to run the tests. The tests (especially the Valgrind flavour) would run a worker, wait until it prints a "Waiting for a new command" line, and try to kill it using SIGTERM. The problem is, the global_stop_flag check could have already been executed by the worker, and it would hang forever in recv(). The solution seems to be to use signalfd and select()/poll(). I've never used either before, but it seems to work well enough - at least the very same tests pass and don't hang now.
2023-05-15signal: refactoringEgor Tensin
2023-05-15signal: refactoring, add comments in tcp_server, etc.Egor Tensin
2023-05-13use -std=c17 -WpedanticEgor Tensin
2023-05-06get rid of __attribute__((constructor))Egor Tensin
Explicit is better than implicit.
2022-12-02add copyright noticesEgor Tensin
2022-09-08log: refactoringEgor Tensin
2022-08-28don't use the latest glibc featuresEgor Tensin
pthread_attr_setsigmask_np is only available since 2.32, which is too modern.
2022-08-26fix pthread error handlingEgor Tensin
pthread functions return positive error codes.
2022-08-26worker: allow graceful shutdownsEgor Tensin
Well, maybe "graceful" is a strong word, but now you _can_ do ./server & ./worker & ./client ci_run URL REV && kill "$( pidof worker )" and the worker will wait for the CI run to complete.