Changeset 15041 for trunk/FACT++
- Timestamp:
- 03/13/13 10:48:43 (12 years ago)
- Location:
- trunk/FACT++/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/StateMachineDimControl.cc
r15021 r15041 315 315 int StateMachineDimControl::HandleStates(const string &server, DimDescriptions *dim) 316 316 { 317 fMutex.lock();317 const lock_guard<mutex> guard(fMutex); 318 318 319 319 const auto is = fCurrentStateList.find(server); … … 332 332 } 333 333 334 fMutex.unlock();335 336 334 return GetCurrentState(); 337 335 } … … 339 337 int StateMachineDimControl::HandleDescriptions(DimDescriptions *dim) 340 338 { 341 fMutex.lock();339 const lock_guard<mutex> guard(fMutex); 342 340 343 341 for (auto it=dim->descriptions.begin(); it!=dim->descriptions.end(); it++) 344 342 fServiceDescriptionList[it->front().name].assign(it->begin(), it->end()); 345 346 fMutex.unlock();347 343 348 344 return GetCurrentState(); … … 382 378 // Make a copy of the list to be able to 383 379 // lock the access to the list 384 fMutex.lock(); 380 381 const lock_guard<mutex> guard(fMutex); 385 382 fServerList.insert(server); 386 fMutex.unlock();387 383 388 384 return GetCurrentState(); … … 391 387 int StateMachineDimControl::HandleServerRemove(const string &server) 392 388 { 393 fMutex.lock();389 const lock_guard<mutex> guard(fMutex); 394 390 fServerList.erase(server); 395 fMutex.unlock();396 391 397 392 return GetCurrentState(); … … 402 397 vector<string> rc; 403 398 404 fMutex.lock();399 const lock_guard<mutex> guard(fMutex); 405 400 406 401 rc.reserve(fServerList.size()); … … 408 403 rc.push_back(*it); 409 404 410 fMutex.unlock();411 412 405 return rc; 413 406 } … … 435 428 vector<string> rc; 436 429 437 fMutex.lock();430 const lock_guard<mutex> guard(fMutex); 438 431 439 432 for (auto it=fServiceList.begin(); it!=fServiceList.end(); it++) … … 441 434 rc.push_back(it->server+"/"+it->service); 442 435 443 fMutex.unlock();444 436 return rc; 437 } 438 439 set<Service> StateMachineDimControl::GetServiceList() 440 { 441 const lock_guard<mutex> guard(fMutex); 442 return fServiceList; 445 443 } 446 444 … … 467 465 // Make a copy of the list to be able to 468 466 // lock the access to the list 469 fMutex.lock();467 const lock_guard<mutex> guard(fMutex); 470 468 fServiceList.insert(svc); 471 fMutex.unlock();472 469 473 470 return GetCurrentState(); … … 476 473 bool StateMachineDimControl::HasServer(const std::string &server) 477 474 { 478 fMutex.lock(); 479 const bool rc = fServerList.find(server)!=fServerList.end(); 480 fMutex.unlock(); 481 482 return rc; 475 const lock_guard<mutex> guard(fMutex); 476 return fServerList.find(server)!=fServerList.end(); 483 477 } 484 478 -
trunk/FACT++/src/StateMachineDimControl.h
r14741 r15041 61 61 std::vector<Description> GetDescription(const std::string &service); 62 62 std::vector<State> GetStates(const std::string &server); 63 63 std::set<Service> GetServiceList(); 64 64 65 65 int PrintStates(std::ostream &out, const std::string &serv="");
Note:
See TracChangeset
for help on using the changeset viewer.