-
Notifications
You must be signed in to change notification settings - Fork 4k
Closed
Description
Currently, to ensure fork safety when dealing with system resources, we add hand-baked getpid() tests in relevant APIs.
We could instead have a centralized after-fork facility such as:
AfterForkToken RegisterAtFork(std::function<void()> after_fork);The returned token would have to be kept alive for as long as the after-fork callbacks are to be registered.
(a more elaborate overload with before-fork, after-fork-in-parent, after-fork-in-child callbacks could also be added if necessary)
Reporter: Antoine Pitrou / @pitrou
Assignee: Antoine Pitrou / @pitrou
Related issues:
- [C++] Use self-pipe in signal-receiving StopSource (is related to)
- [C++] Remove GlobalForkSafeMutex (is required by)
PRs and other links:
Note: This issue was originally created as ARROW-17975. Please see the migration documentation for further details.