Skip to content

Commit 2bf58c7

Browse files
committed
Same for openFile
1 parent a49640d commit 2bf58c7

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

src/IO/ADIOS/ADIOS2IOHandler.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,14 +1032,8 @@ void ADIOS2IOHandlerImpl::openFile(
10321032
}
10331033

10341034
std::string name = parameters.name + fileSuffix();
1035-
10361035
auto file = std::get<PE_InvalidatableFile>(getPossiblyExisting(name));
10371036

1038-
associateWithFile(writable, file);
1039-
1040-
writable->written = true;
1041-
writable->abstractFilePosition = std::make_shared<ADIOS2FilePosition>();
1042-
10431037
auto how_to_open = [&]() {
10441038
switch (parameters.reopen)
10451039
{
@@ -1054,8 +1048,18 @@ void ADIOS2IOHandlerImpl::openFile(
10541048
}();
10551049

10561050
// enforce opening the file
1057-
// lazy opening is deathly in parallel situations
1051+
// lazy opening is deadly in parallel situations
10581052
auto &fileData = getFileData(file, how_to_open);
1053+
1054+
// the following calls present the new file to the IO handler's data
1055+
// structures. do this only after the file has been successfully open, to
1056+
// avoid invalid state.
1057+
1058+
associateWithFile(writable, file);
1059+
1060+
writable->written = true;
1061+
writable->abstractFilePosition = std::make_shared<ADIOS2FilePosition>();
1062+
10591063
*parameters.out_parsePreference = fileData.parsePreference;
10601064
m_dirty.emplace(std::move(file));
10611065
}

0 commit comments

Comments
 (0)