You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/02/08 01:09:46 UTC

[GitHub] [arrow] framlog commented on a change in pull request #12358: ARROW-15593: [C++] Make after-fork ThreadPool reinitialization thread-safe

framlog commented on a change in pull request #12358:
URL: https://github.com/apache/arrow/pull/12358#discussion_r801187688



##########
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:
       nit: Maybe it's not trivial when working with multiprocessing in Python. Why not use a `unique_ptr` here?




-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org