Skip to content

Commit

Permalink
Merge pull request #1995 from eisenhauer/AddDestroyedState
Browse files Browse the repository at this point in the history
Add a Destroyed state to streams
  • Loading branch information
eisenhauer authored Mar 1, 2020
2 parents e41149c + c4b9b09 commit ab2d2e4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
3 changes: 1 addition & 2 deletions source/adios2/toolkit/sst/cp/cp_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,7 @@ extern void SstStreamDestroy(SstStream Stream)
CP_verbose(Stream, "Destroying stream %p, name %s\n", Stream,
Stream->Filename);
pthread_mutex_lock(&Stream->DataLock);
Stream->Status = Closed;
Stream->Status = Destroyed;
struct _TimestepMetadataList *Next = Stream->Timesteps;
while (Next)
{
Expand Down Expand Up @@ -1139,7 +1139,6 @@ extern void SstStreamDestroy(SstStream Stream)
CP_verbose(
Stream,
"Reference count now zero, Destroying process SST info cache\n");
// wait .1 sec for last messages
CManager_close(CPInfo->cm);
if (CPInfo->ffs_c)
free_FFSContext(CPInfo->ffs_c);
Expand Down
3 changes: 2 additions & 1 deletion source/adios2/toolkit/sst/cp/cp_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ enum StreamStatus
Established,
PeerClosed,
PeerFailed,
Closed
Closed,
Destroyed
};

static char *SSTStreamStatusStr[] = {"NotOpen", "Opening", "Established",
Expand Down
2 changes: 2 additions & 0 deletions source/adios2/toolkit/sst/cp/cp_reader.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ extern void ReaderConnCloseHandler(CManager cm, CMConnection ClosedConn,
SstStream Stream = (SstStream)client_data;
int FailedPeerRank = -1;
CP_verbose(Stream, "Reader-side close handler invoked\n");
if (Stream->Status == Destroyed)
return;
if (!Stream->ConnectionsToWriter)
return;
for (int i = 0; i < Stream->WriterCohortSize; i++)
Expand Down
16 changes: 9 additions & 7 deletions testing/adios2/engine/staging-common/TestCommonReadAttrs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,16 +293,18 @@ TEST_F(CommonReadTest, ADIOS2CommonRead1D8)
TimeGapDetected++;
}

if (TimeGapExpected)
if (!IgnoreTimeGap)
{
EXPECT_TRUE(TimeGapDetected);
if (TimeGapExpected)
{
EXPECT_TRUE(TimeGapDetected);
}
else
{
EXPECT_FALSE(TimeGapDetected);
}
}
else
{
EXPECT_EQ(t, NSteps);

EXPECT_FALSE(TimeGapDetected);
}
// Close the file
engine.Close();
}
Expand Down

0 comments on commit ab2d2e4

Please sign in to comment.