#include <stdlib.h>#include <sys/types.h>#include <sys/wait.h>#include <assert.h>#include <unistd.h>#include "process.h"

Classes | |
| class | PollDelay |
Functions | |
| void | init_process_overseer () |
| bool | poll_death () |
| void init_process_overseer | ( | ) |
This must be called at the beginning of the program. It will fork of a new process. The child will continue with the main operation while the parent will listen to any potential process start requests.
We need to be able to catch the death signal of the main before we fork, afterward we might be too late
We are the child and should simply continue with the rest of the program.
This is the overseer process
References assert(), child_died_signal, from_main, from_overseer, listen_to_main_requests(), main_pid, overseer_child_died(), pipe_signal, to_main, and to_overseer.
Referenced by ForkQuick::ForkQuick().
| bool poll_death | ( | ) |
This function will check whether there is any process that ended its life so far. If so, it will call that process with died() So the thread will jump from the poll_Death function to any of the died calls in a process. This is important for Qt since a random thread indirectly started through an exec might end up in the user interface thread. As such it is very important to check the process end status independently before proceeding in Qt.
References assert(), from_overseer, i, ExitStatus::pid, processes, pulling, and ExitStatus::status.
Referenced by Process::exec(), main(), and SongSelectorLogic::timerTick().
1.6.2