Skip to content

Commit

Permalink
fix status updates when multithreading is on
Browse files Browse the repository at this point in the history
  • Loading branch information
nil0x42 committed Sep 4, 2020
1 parent df16fbb commit 0efd5a9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/chunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "hash.h"
#include "const.h"
#include "config.h"
#include "status.h"


int count_chunks(void)
Expand Down Expand Up @@ -87,4 +88,5 @@ void cleanout_chunk(t_chunk *chunk)
}
}
free(chunk);
update_status(CTASK_DONE);
}
5 changes: 3 additions & 2 deletions src/tag_duplicates.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ static void tag_subchunks(threadpool thpool, const t_chunk *parent)
exit(1);
chunk_id ++;
}
update_status(CHUNK_DONE);
}

/** For each chunk, load it into hmap and remove all duplicates
Expand All @@ -53,6 +54,7 @@ void tag_duplicates(void)
while (get_next_chunk(&main_chunk, g_file))
{
populate_hmap(&main_chunk);
update_status(CTASK_DONE);
tag_subchunks(thpool, &main_chunk);
thpool_wait(thpool);
}
Expand All @@ -79,8 +81,8 @@ static void tag_subchunks(const t_chunk *parent)
memcpy(heap_chunk, &chunk, sizeof(t_chunk));

cleanout_chunk(heap_chunk);
update_status(CTASK_DONE);
}
update_status(CHUNK_DONE);
}

/** For each chunk, load it into hmap and remove all duplicates
Expand All @@ -99,7 +101,6 @@ void tag_duplicates(void)
update_status(CTASK_DONE);

tag_subchunks(&main_chunk);
update_status(CHUNK_DONE);
}
}

Expand Down

0 comments on commit 0efd5a9

Please sign in to comment.