mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-03 22:33:29 +00:00
Ensures deterministic initial state for the atomic flag.
This commit is contained in:
parent
dbbea78b76
commit
adb3811847
@ -12,6 +12,11 @@
|
||||
|
||||
using namespace Concurrency;
|
||||
|
||||
BestEffortUpdater::BestEffortUpdater() {
|
||||
// ATOMIC_FLAG_INIT isn't necessarily safe to use, so establish default state by other means.
|
||||
update_is_ongoing_.clear();
|
||||
}
|
||||
|
||||
void BestEffortUpdater::update() {
|
||||
// Perform an update only if one is not currently ongoing.
|
||||
if(!update_is_ongoing_.test_and_set()) {
|
||||
|
@ -25,6 +25,8 @@ namespace Concurrency {
|
||||
*/
|
||||
class BestEffortUpdater {
|
||||
public:
|
||||
BestEffortUpdater();
|
||||
|
||||
/// A delegate receives timing cues.
|
||||
struct Delegate {
|
||||
virtual void update(BestEffortUpdater *updater, int cycles, bool did_skip_previous_update) = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user