Integrates the contents of StaticProcesses into PosixEventDriverProcesses to fully hide it form the Windows build. It also changes lockedProcessInfo to be a non-template function, as that lead to a linker error on macOS.
It turns out that in a heterogeneous process where other parts of the code may start processes or threads and may be waiting for those to finish, it is not realistic to rely on signalfd or even SIGCHLD in general to get notified about child process exits. The only solid way appears to be to start a separate waiter thread that uses waitid/waitpid to wait for exited child processes in a blocking way.
This also fixes the hanging vibe.core.process test in vibe-core with DMD 2.087.x.
Instead of using waitpid(-1), explicitly waits on all known processes. This is inefficient for large numbers of child processes, but seems to be the only way to ensure to not interfere with other code that uses waitpid().
This mainly affected macOS, which currently uses the polling directory watcher. Since entries were freed during the loop, the remaining keys could point to already freed entries.
Before, the mode GENERIC_WRITE was used. This tells Windows to not
append to the file, but overwrite it normally. This is not the intended
semantics. FILE_APPEND_DATA does what we want.
The m_files field was accessed from the worker threads, which is unsafe, because the chunk index of the ChoppedVector could change at any time. The accessed field is now copied to the worker thread instead.
Also, instead of a custom spin lock, StaticTaskPool now uses a normal Mutex, which is just as fast, but emits the proper memory barriers and is integrated with LDC's thread sanitizer.
Accessing the event slot should only be done from the owner thread, since the chunk index of the ChoppedVector could be updated at any time. Instead of a triggerAll field, this flag is now propagated through the underlying eventfd/socket pair.
This doesn't duplicate the definitions form `core.sys.linux.sys.eventfd` and will pickup any platform specifics for better portability.
Fixes https://github.com/vibe-d/eventcore/issues/102
On Linux this option was always set, regardless if the `StreamListenOptions` specifies it.
On some systems setting that option will result in a failure.
Avoids calling the wait callback with reference count zero. In case of a non-pending timer, the wait will be canceled if the wait reference is the last one to avoid keeping starved timers.
This allows getting notified also if the timer has been stopped, so that it is guaranteed to be called, except if cancelWait is called.
Necessary for fixing vibe-d/vibe-core#86
This avoids crashing in case of any handle references left-over in GC allocated memory that gets finalized after module destructors have already been run.