| 62 | |
| 63 | |
| 64 | std::shared_future<CVoid> GEvent::asyncProcess(GEventAsyncStrategy strategy) { |
| 65 | CGRAPH_ASSERT_NOT_NULL_THROW_ERROR(thread_pool_) |
| 66 | std::shared_future<CVoid> future = thread_pool_->commit([this] { |
| 67 | this->trigger(this->param_); |
| 68 | }, CGRAPH_POOL_TASK_STRATEGY); |
| 69 | |
| 70 | /** |
| 71 | * 根据具体策略,将 future信息放到对应的容器中 |
| 72 | * 在特定的时间点,等待执行结束 |
| 73 | */ |
| 74 | if (GEventAsyncStrategy::PIPELINE_RUN_FINISH == strategy) { |
| 75 | CGRAPH_LOCK_GUARD lock(async_run_finished_lock_); |
| 76 | async_run_finish_futures_.emplace_back(future); |
| 77 | } else if (GEventAsyncStrategy::PIPELINE_DESTROY == strategy) { |
| 78 | CGRAPH_LOCK_GUARD lock(async_destroy_lock_); |
| 79 | async_destroy_futures_.emplace_back(future); |
| 80 | } |
| 81 | return future; |
| 82 | } |
| 83 | |
| 84 | |
| 85 | CVoid GEvent::asyncWait(GEventAsyncStrategy strategy) { |
no test coverage detected