title: Is the execution of a c++ 11 atomic object also atomic ?
body: <p>I have a object and all its function should be executed in sequential order.
  I know it is possible to do that with a mutex like </p>
  
  <pre><code>#include &lt;mutex&gt; 
  
  class myClass {
  private:
      std::mutex mtx;
  public:
      void exampleMethod();
  };
  
  void myClass::exampleMethod() {
      std::unique_lock&lt;std::mutex&gt; lck (mtx); // lock mutex until end of scope
  
      // do some stuff
  }
  </code></pre>
  
  <p>but with this technique a deadlock occurs after calling an other mutex locked method within exampleMethod.</p>
  
  <p>so i'm searching for a better resolution.
  the default std::atomic access is sequentially consistent, so its not possible to read an write to this object at the same time, but now when i access my object and call a method, is the whole function call also atomic or more something like</p>
  
  <pre><code>object* obj = atomicObj.load(); // read atomic
  obj.doSomething(); // call method from non atomic object;
  </code></pre>
  
  <p>if yes is there a better way than locking the most functions with a mutex ?</p>