Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
Doris-Extras committed May 21, 2024
1 parent 98f4a37 commit fd1a10e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions be/src/util/once.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ class DorisCallOnce {

// Return the stored result. The result is only meaningful when `has_called() == true`.
ReturnType stored_result() const {
std::lock_guard l(_flag_lock);
if (!has_called()) {
// Could not return status if the method not called.
throw std::exception();
}
if (_eptr) {
std::rethrow_exception(_eptr);
}
Expand All @@ -120,7 +123,7 @@ class DorisCallOnce {
private:
std::atomic<bool> _has_called;
// std::once_flag _once_flag;
mutable std::mutex _flag_lock;
std::mutex _flag_lock;
std::exception_ptr _eptr;
ReturnType _status;
};
Expand Down

0 comments on commit fd1a10e

Please sign in to comment.