diff --git a/cpp/src/arrow/util/cancel.cc b/cpp/src/arrow/util/cancel.cc index b3a0c1f92c24e..242852f46b73c 100644 --- a/cpp/src/arrow/util/cancel.cc +++ b/cpp/src/arrow/util/cancel.cc @@ -50,7 +50,7 @@ struct StopSourceImpl { Status cancel_error_; }; -StopSource::StopSource() : impl_(new StopSourceImpl) {} +StopSource::StopSource() : impl_(std::make_shared()) {} StopSource::~StopSource() = default; diff --git a/cpp/src/arrow/util/cancel.h b/cpp/src/arrow/util/cancel.h index f0d704b2ce086..863b2c4e8ca90 100644 --- a/cpp/src/arrow/util/cancel.h +++ b/cpp/src/arrow/util/cancel.h @@ -58,7 +58,7 @@ class ARROW_EXPORT StopSource { class ARROW_EXPORT StopToken { public: // Public for Cython - StopToken() {} + StopToken() = default; explicit StopToken(std::shared_ptr impl) : impl_(std::move(impl)) {} diff --git a/cpp/src/arrow/util/thread_pool.cc b/cpp/src/arrow/util/thread_pool.cc index d59d1f20de7c3..8aa6d548893de 100644 --- a/cpp/src/arrow/util/thread_pool.cc +++ b/cpp/src/arrow/util/thread_pool.cc @@ -460,7 +460,10 @@ static void WorkerLoop(std::shared_ptr state, std::move(task.stop_callback)(stop_token->Poll()); } } - ARROW_UNUSED(std::move(task)); // release resources before waiting for lock + { + auto tmp_task = std::move(task); // release resources before waiting for lock + ARROW_UNUSED(tmp_task); + } lock.lock(); } if (ARROW_PREDICT_FALSE(--state->tasks_queued_or_running_ == 0)) {