00001 #include <assert.h> 00002 #include "SDL_thread.h" 00003 00004 #include <random_utils/ThreadSafeObject.h> 00005 00006 00007 namespace random_utils 00008 { 00009 00010 ThreadSafeObject::ThreadSafeObject() 00011 { 00012 m_lockCount = 0; 00013 m_syncMutex = SDL_CreateMutex(); 00014 assert(m_syncMutex != NULL); 00015 m_mutexMutex = SDL_CreateMutex(); 00016 assert(m_mutexMutex != NULL); 00017 } 00018 00019 ThreadSafeObject::~ThreadSafeObject() 00020 { 00021 assert(!m_lockCount); 00022 SDL_DestroyMutex(m_syncMutex); 00023 SDL_DestroyMutex(m_mutexMutex); 00024 } 00025 00026 } // namespace random_utils
1.5.1