c++ Programming Glossary: threadsafegame
Need some feedback on how to make a class “thread-safe” http://stackoverflow.com/questions/3482352/need-some-feedback-on-how-to-make-a-class-thread-safe with a mutex I gave it a try and created a class called ThreadSafeGame cpp that looks like this class ThreadSafeGame public ThreadSafeGame.. class called ThreadSafeGame cpp that looks like this class ThreadSafeGame public ThreadSafeGame std auto_ptr Game inGame mGame inGame.release.. cpp that looks like this class ThreadSafeGame public ThreadSafeGame std auto_ptr Game inGame mGame inGame.release const Game getGame..
Need some feedback on how to make a class “thread-safe” http://stackoverflow.com/questions/3482352/need-some-feedback-on-how-to-make-a-class-thread-safe mGame mutable boost mutex mMutex Usage example assuming threadSafeGame is pointer to a ThreadSafeGame object. First lock the game object... First lock the game object. boost mutex scoped_lock lock threadSafeGame getMutex Then access it. Game game threadSafeGame getGame game.. lock threadSafeGame getMutex Then access it. Game game threadSafeGame getGame game move Direction_Down It has the same drawback in..
|