42 if(!resource.second.first) {
43 resource.second.first = std::make_shared<std::recursive_mutex>();
45 ++resource.second.second;
49 ++mutexAndCounter.second;
53 if(mutexAndCounter.second == 1) {
55 mutexAndCounter.first = std::make_shared<std::recursive_mutex>();
61 }
else if(mutexAndCounter.second == 2) {
62 mutexAndCounter.first = std::make_shared<std::recursive_mutex>();
70 resourceForDelayedReader_.reset(
new std::recursive_mutex{});
72 std::vector<std::recursive_mutex*> mutexes = {resourceForDelayedReader_.get()};
93 std::map<std::pair<unsigned int, std::string>, std::recursive_mutex*> sortedResources;
104 if(resource.second.second > 1) {
105 sortedResources.insert(std::make_pair(std::make_pair(resource.second.second, resource.first),resource.second.first.get()));
110 for(
auto const&
name : resourceNames) {
114 if(resource->second.second > 1) {
115 sortedResources.insert(std::make_pair(std::make_pair(resource->second.second, resource->first),resource->second.first.get()));
120 std::vector<std::recursive_mutex*> mutexes;
121 mutexes.reserve(sortedResources.size());
122 for(
auto const& resource: sortedResources) {
123 mutexes.push_back(resource.second);
SharedResourcesAcquirer createAcquirerForSourceDelayedReader()
SharedResourcesRegistry()
std::map< std::string, std::pair< std::shared_ptr< std::recursive_mutex >, unsigned int > > resourceMap_
SharedResourcesAcquirer createAcquirer(std::vector< std::string > const &) const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
static SharedResourcesRegistry * instance()
void registerSharedResource(const std::string &)
A resource name must be registered before it can be used in the createAcquirer call.
static const std::string kLegacyModuleResourceName
All legacy modules share this resource.
std::shared_ptr< std::recursive_mutex > resourceForDelayedReader_