- Timestamp:
- Oct 30, 2015, 11:43:20 AM (10 years ago)
- Children:
- dd7c44
- Parents:
- 959c82
- git-author:
- Frederik Heber <heber@…> (07/10/15 08:28:17)
- git-committer:
- Frederik Heber <heber@…> (10/30/15 11:43:20)
- Location:
- src
- Files:
-
- 2 edited
-
CodePatterns/Observer/Channels.hpp (modified) (2 diffs)
-
Observer/Channels.cpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/CodePatterns/Observer/Channels.hpp
r959c82 r1f96ec 15 15 16 16 #include <map> 17 18 #include <boost/thread/recursive_mutex.hpp> 17 19 18 20 #include "CodePatterns/Observer/defs.hpp" … … 64 66 65 67 NotificationTypetoRefMap ChannelMap; 68 69 mutable boost::recursive_mutex ChannelLock; //!< a lock for the pointer of the instance 66 70 }; 67 71 -
src/Observer/Channels.cpp
r959c82 r1f96ec 20 20 #include "CodePatterns/MemDebug.hpp" 21 21 22 #include <boost/thread/locks.hpp> 23 22 24 #include "CodePatterns/Assert.hpp" 23 25 … … 31 33 Channels::~Channels() 32 34 { 35 boost::recursive_mutex::scoped_lock guard(ChannelLock); 33 36 // free all present Notifications 34 37 for(NotificationTypetoRefMap::iterator iter = ChannelMap.begin(); … … 40 43 void Channels::addChannel(size_t no) 41 44 { 45 boost::recursive_mutex::scoped_lock guard(ChannelLock); 42 46 #ifndef NDEBUG 43 47 NotificationTypetoRefMap::const_iterator iter = ChannelMap.find(no); … … 50 54 void Channels::removeChannel(size_t no) 51 55 { 56 boost::recursive_mutex::scoped_lock guard(ChannelLock); 52 57 NotificationTypetoRefMap::iterator iter = ChannelMap.find(no); 53 58 ASSERT(iter != ChannelMap.end(), … … 59 64 void Channels::subjectKilled(Observable * const publisher) 60 65 { 66 boost::recursive_mutex::scoped_lock guard(ChannelLock); 61 67 for(NotificationTypetoRefMap::iterator iter = ChannelMap.begin(); 62 68 iter != ChannelMap.end();++iter) { … … 67 73 Notification_ptr Channels::getChannel(size_t no) const 68 74 { 75 boost::recursive_mutex::scoped_lock guard(ChannelLock); 69 76 NotificationTypetoRefMap::const_iterator iter = ChannelMap.find(no); 70 77 ASSERT(iter != ChannelMap.end(), … … 75 82 size_t Channels::getType(Notification_ptr channel) const 76 83 { 84 boost::recursive_mutex::scoped_lock guard(ChannelLock); 77 85 return channel->getChannelNo(); 78 86 }
Note:
See TracChangeset
for help on using the changeset viewer.
