framlog commented on a change in pull request #12358:
URL: https://github.com/apache/arrow/pull/12358#discussion_r801431781
##########
File path: cpp/src/arrow/util/mutex.cc
##########
@@ -50,5 +55,31 @@ Mutex::Guard Mutex::Lock() {
Mutex::Mutex() : impl_(new Impl, [](Impl* impl) { delete impl; }) {}
+#ifndef _WIN32
+namespace {
+
+struct AfterForkState {
+ // A global instance that will also register the atfork handler when
+ // constructed.
+ static AfterForkState instance;
+
+ // The mutex may be used at shutdown, so make it eternal.
+ // The leak (only in child processes) is a small price to pay for robustness.
+ Mutex* mutex = nullptr;
Review comment:
> That should be ok. For example, imagine your process is on pid 100.
You create `multiprocessing.Pool` with size 10. It will create processes 101,
102, ..., 110. Each of those child processes will be just a tiny bit too large
(~40 bytes). Process 100 will still be the correct size. When you destroy the
pool the processes 101-110 go away. Process 100 remains and is still the
correct size. When you create a new pool the whole thing repeats with 10 new
process IDs.
Yep. You are right. thanks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]