Is cocos2d isTouchEnabled
flag thread safe ? I want to set this flag in different thread .
If not can I use boost::mutex to guard it before access it ?
If not what objective-c class should I use to guard this ?
Many thanks
Is cocos2d isTouchEnabled
flag thread safe ? I want to set this flag in different thread .
If not can I use boost::mutex to guard it before access it ?
If not what objective-c class should I use to guard this ?
Many thanks
No. The isTouchEnabled
property is not thread safe. In fact, (almost) all properties of Cocos2D classes use the nonatomic property keyword to remove locks in favor of increasing the performance of property access.
But it makes no difference if you ensure that you are changing that particular property only from a particular thread.
The Objective-C pendant for mutex locks is NSLock respectively @synchronized.