Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 'undefined symbol: pthread_atfork' on PowerPC64 #15

Merged
merged 2 commits into from
Aug 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cpp/src/arrow/util/mutex.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include <mutex>

#ifndef _WIN32
#if !defined( _WIN32) && !defined(__ppc64__)
#include <pthread.h>
#include <atomic>
#endif
Expand Down Expand Up @@ -55,7 +55,7 @@ Mutex::Guard Mutex::Lock() {

Mutex::Mutex() : impl_(new Impl, [](Impl* impl) { delete impl; }) {}

#ifndef _WIN32
#if !defined( _WIN32) && !defined(__ppc64__)
namespace {

struct AfterForkState {
Expand Down Expand Up @@ -102,7 +102,7 @@ Mutex* GlobalForkSafeMutex() {

return AfterForkState::instance.mutex;
}
#endif // _WIN32
#endif // _WIN32 and __ppc64__

} // namespace util
} // namespace arrow
2 changes: 1 addition & 1 deletion cpp/src/arrow/util/mutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class ARROW_EXPORT Mutex {
std::unique_ptr<Impl, void (*)(Impl*)> impl_;
};

#ifndef _WIN32
#if !defined(_WIN32) && !defined(__ppc64__)
/// Return a pointer to a process-wide, process-specific Mutex that can be used
/// at any point in a child process. NULL is returned when called in the parent.
///
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/arrow/util/thread_pool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ ThreadPool::ThreadPool()
: sp_state_(std::make_shared<ThreadPool::State>()),
state_(sp_state_.get()),
shutdown_on_destroy_(true) {
#ifndef _WIN32
#if !defined(_WIN32) && !defined(__ppc64__)
pid_ = getpid();
#endif
}
Expand All @@ -234,7 +234,7 @@ ThreadPool::~ThreadPool() {
}

void ThreadPool::ProtectAgainstFork() {
#ifndef _WIN32
#if !defined(_WIN32) && !defined(__ppc64__)
pid_t current_pid = getpid();
if (pid_.load() != current_pid) {
// Reinitialize internal state in child process after fork().
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/util/thread_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ class ARROW_EXPORT ThreadPool : public Executor {
std::shared_ptr<State> sp_state_;
State* state_;
bool shutdown_on_destroy_;
#ifndef _WIN32
#if !defined(_WIN32) && !defined(__ppc64__)
std::atomic<pid_t> pid_;
#endif
};
Expand Down