github-actions[bot] commented on code in PR #39470: URL: https://github.com/apache/doris/pull/39470#discussion_r1719583834
########## be/src/util/once.h: ########## @@ -42,95 +46,63 @@ // } // // bool is_inited() const { -// return _init_once.has_called() && _init_once.stored_result().ok(); +// return _init_once.is_called() && _init_once.stored_result().ok(); // } // private: // Status _do_init() { /* init logic here */ } // DorisCallOnce<Status> _init_once; // }; -template <typename ReturnType> +template <typename R> class DorisCallOnce { public: - DorisCallOnce() : _has_called(false) {} - - // this method is not exception safe, it will core when exception occurs in - // callback method. I have tested the code https://en.cppreference.com/w/cpp/thread/call_once. - // If the underlying `once_flag` has yet to be invoked, invokes the provided - // lambda and stores its return value. Otherwise, returns the stored Status. - // template <typename Fn> - // ReturnType call(Fn fn) { - // std::call_once(_once_flag, [this, fn] { - // _status = fn(); - // _has_called.store(true, std::memory_order_release); - // }); - // return _status; - // } + DorisCallOnce() : _is_exception_throwed(false), _eptr(nullptr) {} Review Comment: warning: use '= default' to define a trivial default constructor [modernize-use-equals-default] ```suggestion DorisCallOnce() : _is_exception_throwed(false), _eptr(nullptr) = default; ``` ########## be/src/util/once.h: ########## @@ -20,9 +20,13 @@ #pragma once +#include <glog/logging.h> Review Comment: warning: 'glog/logging.h' file not found [clang-diagnostic-error] ```cpp #include <glog/logging.h> ^ ``` -- 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: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org