Commit 53ebcce 1 parent 0928a7a commit 53ebcce Copy full SHA for 53ebcce
File tree 1 file changed +7
-9
lines changed
1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -9205,7 +9205,7 @@ GetFileClusterNamesType CDistributedFileDirectory::getFileClusterNames(const cha
9205
9205
// --------------------------------------------------------
9206
9206
9207
9207
9208
- static CDistributedFileDirectory *DFdir = NULL ;
9208
+ static std::atomic< CDistributedFileDirectory *> DFdir{nullptr} ;
9209
9209
static CriticalSection dfdirCrit;
9210
9210
9211
9211
/**
@@ -9215,12 +9215,10 @@ static CriticalSection dfdirCrit;
9215
9215
*/
9216
9216
IDistributedFileDirectory &queryDistributedFileDirectory()
9217
9217
{
9218
- if (!DFdir) {
9219
- CriticalBlock block(dfdirCrit);
9220
- if (!DFdir)
9221
- DFdir = new CDistributedFileDirectory();
9222
- }
9223
- return *DFdir;
9218
+ CriticalBlock block(dfdirCrit);
9219
+ if (!DFdir.load())
9220
+ DFdir.store(new CDistributedFileDirectory());
9221
+ return *DFdir.load();
9224
9222
}
9225
9223
9226
9224
/**
@@ -9230,7 +9228,7 @@ void closedownDFS() // called by dacoven
9230
9228
{
9231
9229
CriticalBlock block(dfdirCrit);
9232
9230
try {
9233
- delete DFdir;
9231
+ delete DFdir.load() ;
9234
9232
}
9235
9233
catch (IMP_Exception *e) {
9236
9234
if (e->errorCode()!=MPERR_link_closed)
@@ -9243,7 +9241,7 @@ void closedownDFS() // called by dacoven
9243
9241
throw;
9244
9242
e->Release();
9245
9243
}
9246
- DFdir = NULL ;
9244
+ DFdir.store(nullptr) ;
9247
9245
CriticalBlock block2(groupsect);
9248
9246
::Release(groupStore.load());
9249
9247
groupStore.store(nullptr);
You can’t perform that action at this time.
0 commit comments