| 55 | | Threading::MutexFactory::destroy(m_pEventsMutex); |
| 56 | | } |
| 57 | | |
| 58 | | //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ |
| 59 | | I_Event& |
| 60 | | EventQueue::createEvent(const std::string& _name) |
| 61 | | { |
| 62 | | // Since getEvent() will create the event if |
| 63 | | // it doesn't exist, just call it. |
| 64 | | return getEvent(_name); |
| 65 | | } |
| 66 | | |
| 67 | | //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ |
| 68 | | I_Event& |
| 69 | | EventQueue::getEvent(const std::string& _name) |
| 70 | | { |
| 71 | | Threading::CriticalSection guard(m_pEventsMutex); |
| 72 | | |
| 73 | | // TODO Make sure the event has been created. |
| 74 | | Events_type::iterator iter = m_events.find(_name); |
| 75 | | |
| 76 | | if (iter == m_events.end()) |
| 77 | | { |
| 78 | | Event_impl* pEvent = new Event_impl(*this); |
| 79 | | |
| 80 | | m_events[_name] = pEvent; |
| 81 | | |
| 82 | | return *pEvent; |
| 83 | | } |
| 84 | | else |
| 85 | | { |
| 86 | | return *iter->second; |
| 87 | | } |