@@ -8239,20 +8239,22 @@ class CNamedGroupStore: implements INamedGroupStore, public CInterface
8239
8239
8240
8240
};
8241
8241
8242
- static CNamedGroupStore *groupStore = NULL ;
8242
+ static std::atomic< CNamedGroupStore *> groupStore{nullptr} ;
8243
8243
static CriticalSection groupsect;
8244
8244
8245
8245
bool CNamedGroupIterator::match()
8246
8246
{
8247
8247
if (conn.get()) {
8248
8248
if (matchgroup.get()) {
8249
- if (!groupStore)
8249
+ CLeavableCriticalBlock block3(groupsect);
8250
+ if (!groupStore.load())
8250
8251
return false;
8251
8252
const char *name = pe->query().queryProp("@name");
8252
8253
if (!name||!*name)
8253
8254
return false;
8254
8255
GroupType dummy;
8255
- Owned<IGroup> lgrp = groupStore->dolookup(name, conn, NULL, dummy);
8256
+ Owned<IGroup> lgrp = groupStore.load()->dolookup(name, conn, NULL, dummy);
8257
+ block3.leave();
8256
8258
if (lgrp) {
8257
8259
if (exactmatch)
8258
8260
return lgrp->equals(matchgroup);
@@ -8266,14 +8268,13 @@ bool CNamedGroupIterator::match()
8266
8268
return false;
8267
8269
}
8268
8270
8269
- INamedGroupStore &queryNamedGroupStore()
8271
+ INamedGroupStore &queryNamedGroupStore()
8270
8272
{
8271
- if (!groupStore) {
8272
- CriticalBlock block(groupsect);
8273
- if (!groupStore)
8274
- groupStore = new CNamedGroupStore();
8273
+ CriticalBlock block(groupsect);
8274
+ if (!groupStore.load()) {
8275
+ groupStore.store(new CNamedGroupStore());
8275
8276
}
8276
- return *groupStore;
8277
+ return *( groupStore.load()) ;
8277
8278
}
8278
8279
8279
8280
// --------------------------------------------------------
@@ -9244,8 +9245,8 @@ void closedownDFS() // called by dacoven
9244
9245
}
9245
9246
DFdir = NULL;
9246
9247
CriticalBlock block2(groupsect);
9247
- ::Release(groupStore);
9248
- groupStore = NULL ;
9248
+ ::Release(groupStore.load() );
9249
+ groupStore.store(nullptr) ;
9249
9250
}
9250
9251
9251
9252
class CDFPartFilter : implements IDFPartFilter, public CInterface
0 commit comments