Changeset 55200 in vbox for trunk/src/VBox
- Timestamp:
- Apr 13, 2015 3:22:12 AM (10 years ago)
- Location:
- trunk/src/VBox/Main/src-server
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/HostDnsService.cpp
r55199 r55200 38 38 static void dumpHostDnsStrVector(const std::string&, const std::vector<std::string>&); 39 39 40 /* Lockee */41 Lockee::Lockee()42 {43 RTCritSectInit(&mLock);44 }45 46 Lockee::~Lockee()47 {48 RTCritSectDelete(&mLock);49 }50 51 const RTCRITSECT* Lockee::lock() const52 {53 return &mLock;54 }55 56 /* ALock */57 ALock::ALock(const Lockee *aLockee)58 : lockee(aLockee)59 {60 RTCritSectEnter(const_cast<PRTCRITSECT>(lockee->lock()));61 }62 63 ALock::~ALock()64 {65 RTCritSectLeave(const_cast<PRTCRITSECT>(lockee->lock()));66 }67 68 /* HostDnsInformation */69 40 70 41 bool HostDnsInformation::equals(const HostDnsInformation &info) const … … 165 136 void HostDnsMonitor::addMonitorProxy(PCHostDnsMonitorProxy proxy) const 166 137 { 167 ALock l(this);138 RTCLock grab(m_LockMtx); 168 139 m->proxies.push_back(proxy); 169 140 proxy->notify(); … … 172 143 void HostDnsMonitor::releaseMonitorProxy(PCHostDnsMonitorProxy proxy) const 173 144 { 174 ALock l(this);145 RTCLock grab(m_LockMtx); 175 146 std::vector<PCHostDnsMonitorProxy>::iterator it; 176 147 it = std::find(m->proxies.begin(), m->proxies.end(), proxy); … … 198 169 void HostDnsMonitor::setInfo(const HostDnsInformation &info) 199 170 { 200 ALock l(this);171 RTCLock grab(m_LockMtx); 201 172 202 173 if (info.equals(m->info)) … … 279 250 { 280 251 AssertReturn(m && m->info, E_FAIL); 281 ALock l(this);252 RTCLock grab(m_LockMtx); 282 253 283 254 if (m->fModified) … … 295 266 { 296 267 AssertReturn(m && m->info, E_FAIL); 297 ALock l(this);268 RTCLock grab(m_LockMtx); 298 269 299 270 if (m->fModified) … … 311 282 { 312 283 AssertReturn(m && m->info, E_FAIL); 313 ALock l(this);284 RTCLock grab(m_LockMtx); 314 285 315 286 if (m->fModified) -
trunk/src/VBox/Main/src-server/HostDnsService.h
r55198 r55200 21 21 22 22 #include <iprt/cdefs.h> 23 #include <iprt/critsect.h>24 23 #include <iprt/types.h> 24 #include <iprt/cpp/lock.h> 25 25 26 26 #include <list> … … 32 32 class HostDnsMonitorProxy; 33 33 typedef const HostDnsMonitorProxy *PCHostDnsMonitorProxy; 34 35 class Lockee36 {37 public:38 Lockee();39 virtual ~Lockee();40 const RTCRITSECT* lock() const;41 42 private:43 RTCRITSECT mLock;44 };45 46 class ALock47 {48 public:49 explicit ALock(const Lockee *l);50 ~ALock();51 52 private:53 const Lockee *lockee;54 };55 34 56 35 class HostDnsInformation … … 67 46 * it lifecycle starts and ends together with VBoxSVC. 68 47 */ 69 class HostDnsMonitor : public Lockee48 class HostDnsMonitor 70 49 { 71 50 public: … … 96 75 static int threadMonitoringRoutine(RTTHREAD, void *); 97 76 77 protected: 78 mutable RTCLockMtx m_LockMtx; 79 98 80 public: 99 81 struct Data; … … 104 86 * This class supposed to be a proxy for events on changing Host Name Resolving configurations. 105 87 */ 106 class HostDnsMonitorProxy : public Lockee88 class HostDnsMonitorProxy 107 89 { 108 90 public: … … 120 102 private: 121 103 void updateInfo(); 104 105 private: 106 mutable RTCLockMtx m_LockMtx; 122 107 123 108 private: -
trunk/src/VBox/Main/src-server/darwin/HostDnsServiceDarwin.cpp
r54662 r55200 77 77 HostDnsServiceDarwin *pThis = (HostDnsServiceDarwin *)info; 78 78 79 ALock l(pThis);79 RTCLock grab(pThis->m_LockMtx); 80 80 pThis->updateInfo(); 81 81 } … … 116 116 void HostDnsServiceDarwin::monitorThreadShutdown() 117 117 { 118 ALock l(this);118 RTCLock grab(m_LockMtx); 119 119 if (!m->m_fStop) 120 120 {
Note:
See TracChangeset
for help on using the changeset viewer.