yiguolei commented on code in PR #52816:
URL: https://github.com/apache/doris/pull/52816#discussion_r2186283809
##########
be/src/cloud/cloud_meta_mgr.cpp:
##########
@@ -131,6 +131,22 @@ Status bthread_fork_join(const
std::vector<std::function<Status()>>& tasks, int
return status;
}
+void bthread_fork_join(const std::vector<std::function<Status()>>& tasks, int
concurrency,
+ std::future<Status>* fut) {
+ // std::function will cause `copy`, we need to use heap memory to avoid
copy ctor called
+ auto prom = std::make_shared<std::promise<Status>>();
+ *fut = prom->get_future();
+ std::function<void()>* fn =
+ new std::function<void()>([&tasks, concurrency, p =
std::move(prom)]() mutable {
+ p->set_value(bthread_fork_join(tasks, concurrency));
+ });
+
+ bthread_t bthread_id;
+ if (bthread_start_background(&bthread_id, nullptr, run_bthread_work, fn)
!= 0) {
+ run_bthread_work(fn);
Review Comment:
这里如果145 行启动bthread 失败,我们这里这里直接返回 error status?没必要再尝试一次了吧?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]