Tom-Newton commented on code in PR #44897:
URL: https://github.com/apache/arrow/pull/44897#discussion_r1875885152


##########
cpp/src/arrow/util/thread_pool.cc:
##########
@@ -449,8 +468,8 @@ static void WorkerLoop(std::shared_ptr<ThreadPool::State> 
state,
 
       DCHECK_GE(state->tasks_queued_or_running_, 0);
       {
-        Task task = std::move(state->pending_tasks_.front());
-        state->pending_tasks_.pop_front();
+        Task task = 
std::move(const_cast<Task&>(state->pending_tasks_.top().task));

Review Comment:
   That makes sense and its the same as before when it was a `std::dequeue`. 
The difference with `std::priority_queue` is that it returns a `const` 
reference and `std::move` requires a non-const reference. The internal 
container is also protected, so I don't really see any alternative to using 
`const_cast` and as far as I understand it should be safe in this case.  
   
   Do you think the current implementation with `const_cast` is an acceptable 
solution?



-- 
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]

Reply via email to