Skip to content

[C++] Create after-fork facility #33182

@asfimport

Description

@asfimport

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:

PRs and other links:

Note: This issue was originally created as ARROW-17975. Please see the migration documentation for further details.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions