title: In Cocos2d-X, can the TouchDispatcher interfere with Box2d's world step?
body: <p>I'm working on a game using box2d and cocos2d-x, and I wanna check a detail before I overdesign it: is it possible for a callback called by the TouchDispatcher (like ccTouchesBegan, ccTouchesEnded, ccTouchesMoved) to interrupt the execution of Box2d's world step? For example, if my ccTouchesEnded callback was along the lines of:</p>
  
  <pre><code>void GameLayer::ccTouchesEnded(cocos2d::CCSet* touches, cocos2d::CCEvent* event)
  {
      world-&gt;DestroyBody(myBody);//obviously an oversimplification but you get the idea
  }
  </code></pre>
  
  <p>...would it be possible that this could be accidentally called in the middle of the world step's execution, thereby deleting something that the world step is currently processing? </p>
  
  <p>I've looked it up...</p>
  
  <p><a href="https://stackoverflow.com/questions/8985692/box2d-and-wrapping-worlds">Box2D and wrapping worlds</a></p>
  
  <p>...and I've seen that the some can interfere, but the only one that comes up whenever this is discussed is ContactListener, leaving me with the impression that it's a special case or something. Can any callback interfere? Or is the world step atomic to external (non-box2d) threads?</p>
  
  <p>PS. I understand that the example code given doesn't exactly adhere to MVC design philosophy, and to be honest I'm considering changing that (though given the state the project is in it'll cause a lot of delays), but even so I'd still like to know more about exactly how atomic the world step is, even if only for my own reference.</p>
  
  <p>Thanks in advance</p>