Changeset 14567 for trunk/FACT++
- Timestamp:
- 11/06/12 00:23:11 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/StateMachineImp.cc
r14558 r14567 177 177 void StateMachineImp::PushEvent(Event *cmd) 178 178 { 179 fMutex.lock();179 const lock_guard<mutex> guard(fMutex); 180 180 fEventQueue.push(cmd); 181 fMutex.unlock();182 181 } 183 182 … … 193 192 Event *StateMachineImp::PopEvent() 194 193 { 195 fMutex.lock();194 const lock_guard<mutex> guard(fMutex); 196 195 197 196 // Get the next event from the stack … … 199 198 Event *cmd = fEventQueue.front(); 200 199 fEventQueue.pop(); 201 202 fMutex.unlock();203 200 204 201 return cmd; … … 554 551 #endif 555 552 556 fMutexEvt.lock();553 const lock_guard<mutex> guard(fMutexEvt); 557 554 fListOfEvents.push_back(evt); 558 fMutexEvt.unlock();559 560 555 return *evt; 561 556 } … … 622 617 EventImp *evt = CreateService(name); 623 618 624 fMutexEvt.lock();619 const lock_guard<mutex> guard(fMutexEvt); 625 620 fListOfEvents.push_back(evt); 626 fMutexEvt.unlock();627 628 621 return *evt; 629 622 } … … 631 624 void StateMachineImp::Unsubscribe(EventImp *evt) 632 625 { 633 const lock_guard<mutex> guard(fMutexEvt); 634 635 auto it = find(fListOfEvents.begin(), fListOfEvents.end(), evt); 636 if (it==fListOfEvents.end()) 626 { 627 const lock_guard<mutex> guard(fMutexEvt); 628 629 auto it = find(fListOfEvents.begin(), fListOfEvents.end(), evt); 630 if (it==fListOfEvents.end()) 637 631 return; 638 632 639 fListOfEvents.erase(it); 633 fListOfEvents.erase(it); 634 } 640 635 delete evt; 641 636 }
Note:
See TracChangeset
for help on using the changeset viewer.