NAP
dirtyflag.h
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4 
5 #pragma once
6 
7 // Std includes
8 #include <atomic>
9 
10 namespace nap
11 {
12 
13  namespace audio
14  {
15 
20  class DirtyFlag
21  {
22  public:
23  DirtyFlag() { mUpToDate.test_and_set(); }
24 
28  inline void set() { mUpToDate.clear(); }
29 
33  inline bool check() { return !mUpToDate.test_and_set(); }
34 
35  private:
36  std::atomic_flag mUpToDate = ATOMIC_FLAG_INIT;
37  };
38 
39  }
40 
41 }
nap::audio::DirtyFlag::check
bool check()
Definition: dirtyflag.h:33
nap
Definition: templateapp.h:17
nap::audio::DirtyFlag::DirtyFlag
DirtyFlag()
Definition: dirtyflag.h:23
nap::audio::DirtyFlag::set
void set()
Definition: dirtyflag.h:28
nap::audio::DirtyFlag
Definition: dirtyflag.h:20