Allow one thread to execute section while others wait and resume I have a requirement that is summarized below.
void update()
{
  |   |   |   |
  |   |   |   |
  |   |   |   |
 \|  \|  \|  \|
  =============
      meat           &lt;--- Only one thread must execute here, the rest should skip it.
  =============
  |   |   |   |  &lt;--- Other threads wait here until the &quot;first&quot; thread is done w/ &quot;meat&quot;
  |   |   |   |
  |   |   |   |
  |/  |/  |/  |/
}

From an outsider perspective, &quot;meat&quot; should be executed just once (by the first thread that encounters it)
This post is similar but differs in that it also requires other threads to execute the meat code block one at a time.
// testExecutive.cpp
#include &lt;atomic&gt;
#include &lt;condition_variable&gt;
#include &lt;iostream&gt;
#include &lt;mutex&gt;
#include &lt;thread&gt;

struct Target {
  int nhits = 0;
  inline void hit() { ++nhits; }
};

struct Executive {
  Executive() = delete;
  Executive(int _Id, Target &amp;_Tgt) : m_Id(_Id), m_Ready(false), m_Tgt(_Tgt) {}
  void update() {
    { // only one thread can execute this
      std::scoped_lock&lt;std::mutex&gt; lk(m_Mtx);
      // std::cout &lt;&lt; &quot;++Acquired lk &quot; &lt;&lt; m_Id &lt;&lt; &quot; | tid: &quot; &lt;&lt;
      // std::this_thread::get_id() &lt;&lt; &quot;++\n&quot;;
      if (!m_Ready.load()) {
        // std::cout &lt;&lt; &quot;==Updating&quot; &lt;&lt; m_Id &lt;&lt; &quot; | tid: &quot; &lt;&lt;
        // std::this_thread::get_id() &lt;&lt; &quot;==\n&quot;;
        m_Ready.store(true);
        m_Tgt.hit();
        m_Cv.notify_all();
      }
      // std::cout &lt;&lt; &quot;++Releasing lk &quot; &lt;&lt; m_Id &lt;&lt; &quot; | tid: &quot; &lt;&lt;
      // std::this_thread::get_id() &lt;&lt; &quot;++\n&quot;;
    }

    // the rest should wait here
    std::mutex wait_mtx;
    std::unique_lock&lt;std::mutex&gt; lk(wait_mtx);
    m_Cv.wait(lk, [&amp;]() -&gt; bool { return m_Ready.load(); });
  }
  inline void reset() { m_Ready.store(false); }

private:
  int m_Id;
  Target &amp;m_Tgt;
  std::condition_variable m_Cv;
  std::mutex m_Mtx;
  std::atomic_bool m_Ready;
};

int main(int argc, char *argv[]) {
  int n(2);
  if (argc &gt;= 2) {
    n = atoi(argv[1]);
  }
  Target tgt;
  Executive e(1, tgt);
  auto updFn = [&amp;e]() { e.update(); };

  // update same executive from 3 threads. Repeat n times.
  int i(n);
  while (i &gt; 0) {
    e.reset();
    {
      std::thread t1(updFn), t2(updFn), t3(updFn);
      t1.join();
      t2.join();
      t3.join();
    }
    --i;
  }
  std::cout &lt;&lt; (n == tgt.nhits ? &quot;[OK]&quot; : &quot;[ERR]&quot;) &lt;&lt; &quot; Updates: &quot; &lt;&lt; n &lt;&lt; &quot; | &quot;
            &lt;&lt; &quot;Hits: &quot; &lt;&lt; tgt.nhits &lt;&lt; &quot;\n&quot;;
  return 0;
}

I setup a simple method to verify that exactly one out of three threads executes the desired code. The method hit() is called in Executive::Update. Compile and test like so.
jaswant@HAL9000:~$ g++ testExecutive.cpp -lpthread --std=c++17
jaswant@HAL9000:~$ ./a.out 2
[OK] Updates: 2 | Hits: 2
jaswant@HAL9000:~$ ./a.out 100
[OK] Updates: 100 | Hits: 100
jaswant@HAL9000:~$ ./a.out 2
[OK] Updates: 2 | Hits: 2
jaswant@HAL9000:~$ ./a.out 4
[OK] Updates: 4 | Hits: 4
jaswant@HAL9000:~$ ./a.out 8
[OK] Updates: 8 | Hits: 8
jaswant@HAL9000:~$ ./a.out 16
[OK] Updates: 16 | Hits: 16
jaswant@HAL9000:~$ ./a.out 256
[OK] Updates: 256 | Hits: 256
jaswant@HAL9000:~$ ./a.out 1024
[OK] Updates: 1024 | Hits: 1024
jaswant@HAL9000:~$ ./a.out 8192
[OK] Updates: 8192 | Hits: 8192
jaswant@HAL9000:~$ ./a.out 100000
[OK] Updates: 100000 | Hits: 100000

So, it works. Can anyone please point out bad usage of mutex/condition variables/locks and perhaps a way to do this w/o an atomic variable in the predicate?
Use std::once_flag
The std::once_flag class basically does what you want. However, there is no way nice way to reset it, except by using a trick like placement new, or by allocating a flag dynamically, and using a std::unique_ptr to point to it for example. As indi mentioned, it's not really &quot;once&quot; anymore then, but it does work for your specific case. Here is a drop-in replacement for your struct Executive:
struct Executive {
  Executive(int _Id, Target &amp;_Tgt) : m_Id(_Id), m_Tgt(_Tgt) {}
  void update() {
        std::call_once(flag, [this]{ m_Tgt.hit(); });
  }
  void reset() {
    flag.~once_flag();
    new (&amp;flag) std::once_flag;
  }

private:
  int m_Id;
  Target &amp;m_Tgt;
  std::once_flag flag;
};

No need to write inline
If you include the full definition of a member function in a class or struct definition, you don't need to explicitly use the inline specifier, as it will implicitly be an inline function.
Write idiomatic code
There are a few things in your code that are not incorrect in any way, but are a rather unusual way to write things. For example, when declaring an int and initializing it, I would expect int n = 2 or int n{2}, but not int n(2).
Also, when repeating something a number of times, use a for-loop, like so:
for (int i = 0; i &lt; n; ++i) {
    e.reset();
    ...
}

This completely describes how often the loop is run in a single line, which makes it easier to read.