joemarshall commented on code in PR #35672:
URL: https://github.com/apache/arrow/pull/35672#discussion_r1230072096


##########
cpp/src/arrow/util/thread_pool.cc:
##########
@@ -60,11 +61,33 @@ struct SerialExecutor::State {
   std::thread::id current_thread;
   bool paused{false};
   bool finished{false};
+#ifndef ARROW_ENABLE_THREADING
+  int max_tasks_running{1};
+  int tasks_running{0};
+#endif
 };
 
-SerialExecutor::SerialExecutor() : state_(std::make_shared<State>()) {}
+#ifndef ARROW_ENABLE_THREADING
+// list of all SerialExecutor objects - as we need to run tasks from all pools 
at once in
+// Run()
+std::unordered_set<SerialExecutor*> SerialExecutor::all_executors;
+SerialExecutor* SerialExecutor::current_executor = NULL;
+SerialExecutor* SerialExecutor::GetCurrentExecutor() { return 
current_executor; }
+SerialExecutor* SerialExecutor::last_called_executor = NULL;
+
+#endif
+
+SerialExecutor::SerialExecutor() : state_(std::make_shared<State>()) {
+#ifndef ARROW_ENABLE_THREADING
+  all_executors.insert(this);

Review Comment:
   Yep, I'm assuming that the main use case for disabling threading is use of 
arrow in emscripten or similarly constrained environments where threading 
doesn't work (and synchronisation primitives may also not work for that matter 
- in emscripten they are no ops)



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