| 123 | } |
| 124 | |
| 125 | SerialExecutor::~SerialExecutor() { |
| 126 | #ifndef ARROW_ENABLE_THREADING |
| 127 | GetSerialExecutorGlobalState()->all_executors.erase(this); |
| 128 | #endif |
| 129 | auto state = state_; |
| 130 | std::unique_lock<std::mutex> lk(state->mutex); |
| 131 | if (!state->task_queue.empty()) { |
| 132 | // We may have remaining tasks if the executor is being abandoned. We could have |
| 133 | // resource leakage in this case. However, we can force the cleanup to happen now |
| 134 | state->paused = false; |
| 135 | lk.unlock(); |
| 136 | RunLoop(); |
| 137 | lk.lock(); |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | int SerialExecutor::GetNumTasks() { |
| 142 | auto state = state_; |
nothing calls this directly
no test coverage detected