mold icon indicating copy to clipboard operation
mold copied to clipboard

[PERF] Use std::call_once to arrange timer record stop

Open dmantipov opened this issue 3 years ago • 1 comments

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]

dmantipov avatar Feb 14 '22 12:02 dmantipov

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.

rui314 avatar Feb 14 '22 12:02 rui314