Commit 96dfe043 authored by Thomas Jahns's avatar Thomas Jahns 🤸
Browse files

Replace book-keeping array with simple count.

parent 3afe6426
...@@ -25,8 +25,7 @@ typedef struct ...@@ -25,8 +25,7 @@ typedef struct
struct dBuffer *fb; struct dBuffer *fb;
FILE *fp; FILE *fp;
int fileID; int fileID;
bool finished; int activeCollectors;
bool *nfinished;
char name[]; char name[];
} bFiledataP; } bFiledataP;
...@@ -56,11 +55,7 @@ initBFiledataP(char *filename, size_t bs, int nc, int fileID) ...@@ -56,11 +55,7 @@ initBFiledataP(char *filename, size_t bs, int nc, int fileID)
ftruncate(fd, (off_t)0); ftruncate(fd, (off_t)0);
dbuffer_init ( & ( bfp->fb ), ( size_t )( bfp->size )); dbuffer_init ( & ( bfp->fb ), ( size_t )( bfp->size ));
bfp->finished = false; bfp->activeCollectors = nc;
bfp->nfinished = xmalloc ( nc * sizeof ( bfp->nfinished[0] ));
for ( i = 0; i < nc; i++ )
bfp->nfinished[i] = false;
bfp->fileID = fileID; bfp->fileID = fileID;
...@@ -87,8 +82,7 @@ destroyBFiledataP(void *v) ...@@ -87,8 +82,7 @@ destroyBFiledataP(void *v)
dbuffer_cleanup ( &( bfp->fb )); dbuffer_cleanup ( &( bfp->fb ));
free ( bfp->nfinished ); free(bfp);
free ( bfp );
xdebug("%s", "cleaned up, return"); xdebug("%s", "cleaned up, return");
...@@ -255,19 +249,7 @@ pioWriterStdIO(void) ...@@ -255,19 +249,7 @@ pioWriterStdIO(void)
writeP ( bfd, amount ); writeP ( bfd, amount );
bfd->nfinished[source] = true; if ( ! --(bfd->activeCollectors))
bfd->finished = true;
for ( i = 0; i < nProcsCollNode; i++ )
{
if ( bfd->nfinished[i] == false )
{
bfd->finished = false;
break;
}
}
if ( bfd->finished )
{ {
xdebug("all are finished with file %d, delete node", rtag.id); xdebug("all are finished with file %d, delete node", rtag.id);
queueDelNode(bibBFiledataP, fileIDTest, queueDelNode(bibBFiledataP, fileIDTest,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment