timercpp icon indicating copy to clipboard operation
timercpp copied to clipboard

`clear` is not thread-safe wrt memory visibility

Open jayv opened this issue 4 years ago • 0 comments

void Timer::stop() {
    this->clear = true;
}

clear as plain bool has no cross-thread synchronization so in theory the interval timer may run indefinitly, consider using atomic_bool and proper memory ordering.

jayv avatar Jan 14 '21 00:01 jayv