Mercurial > hg > orthanc
comparison OrthancServer/ServerIndex.cpp @ 1453:c0bdc47165ef
code to warn about possible threading problems
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 02 Jul 2015 12:26:44 +0200 |
parents | 0ac74fa21db8 |
children | f967bdf8534e |
comparison
equal
deleted
inserted
replaced
1452:b737acb13da5 | 1453:c0bdc47165ef |
---|---|
562 | 562 |
563 unstableResourcesMonitorThread_ = boost::thread(UnstableResourcesMonitorThread, this); | 563 unstableResourcesMonitorThread_ = boost::thread(UnstableResourcesMonitorThread, this); |
564 } | 564 } |
565 | 565 |
566 | 566 |
567 | |
567 ServerIndex::~ServerIndex() | 568 ServerIndex::~ServerIndex() |
568 { | 569 { |
569 done_ = true; | 570 if (!done_) |
570 | 571 { |
571 if (db_.HasFlushToDisk() && | 572 LOG(ERROR) << "INTERNAL ERROR: ServerIndex::Stop() should be invoked manually to avoid mess in the destruction order!"; |
572 flushThread_.joinable()) | 573 Stop(); |
573 { | 574 } |
574 flushThread_.join(); | 575 } |
575 } | 576 |
576 | 577 |
577 if (unstableResourcesMonitorThread_.joinable()) | 578 |
578 { | 579 void ServerIndex::Stop() |
579 unstableResourcesMonitorThread_.join(); | 580 { |
580 } | 581 if (!done_) |
581 } | 582 { |
583 done_ = true; | |
584 | |
585 if (db_.HasFlushToDisk() && | |
586 flushThread_.joinable()) | |
587 { | |
588 flushThread_.join(); | |
589 } | |
590 | |
591 if (unstableResourcesMonitorThread_.joinable()) | |
592 { | |
593 unstableResourcesMonitorThread_.join(); | |
594 } | |
595 } | |
596 } | |
597 | |
582 | 598 |
583 | 599 |
584 StoreStatus ServerIndex::Store(std::map<MetadataType, std::string>& instanceMetadata, | 600 StoreStatus ServerIndex::Store(std::map<MetadataType, std::string>& instanceMetadata, |
585 const DicomMap& dicomSummary, | 601 const DicomMap& dicomSummary, |
586 const Attachments& attachments, | 602 const Attachments& attachments, |