mold
mold copied to clipboard
[PERF] Use std::call_once to arrange timer record stop
Prefer std::once_flag
and std::call_once()
over plain
C-style flag to arrange (the body of) TimerRecord::stop()
to execute just once, adjust related code.
Signed-off-by: Dmitry Antipov [email protected]
std::call_once
is used to make the thing that is protected by call_once
thread-safe. In this case, stop
is called by a single thread, so we don't need to use call_once
.