Skip to content
Snippets Groups Projects
Commit c1f30119 authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Fix race condition, can increment no. of logs before assignment, so they need to be initially NULL

parent a19e0095
Branches
No related tags found
No related merge requests found
...@@ -321,14 +321,14 @@ static void pick_logs(void) { ...@@ -321,14 +321,14 @@ static void pick_logs(void) {
size_t nlogs = mpiuse_nr_logs(); size_t nlogs = mpiuse_nr_logs();
/* Duplicate of logs. */ /* Duplicate of logs. */
reqs_queue = (struct mpiuse_log_entry **)malloc( reqs_queue = (struct mpiuse_log_entry **)calloc(
sizeof(struct mpiuse_log_entry *) * nlogs); nlogs, sizeof(struct mpiuse_log_entry *));
nr_reqs = 0; nr_reqs = 0;
sends_queue = (struct mpiuse_log_entry **)malloc( sends_queue = (struct mpiuse_log_entry **)calloc(
sizeof(struct mpiuse_log_entry *) * nlogs); nlogs, sizeof(struct mpiuse_log_entry *) * nlogs);
nr_sends = 0; nr_sends = 0;
recvs_queue = (struct mpiuse_log_entry **)malloc( recvs_queue = (struct mpiuse_log_entry **)calloc(
sizeof(struct mpiuse_log_entry *) * nlogs); nlogs, sizeof(struct mpiuse_log_entry *));
nr_recvs = 0; nr_recvs = 0;
for (int k = 0; k < nlogs; k++) { for (int k = 0; k < nlogs; k++) {
...@@ -354,8 +354,9 @@ static void pick_logs(void) { ...@@ -354,8 +354,9 @@ static void pick_logs(void) {
/* Check. */ /* Check. */
for (int k = 0; k < nr_reqs - 1; k++) { for (int k = 0; k < nr_reqs - 1; k++) {
if (reqs_queue[k]->tic > reqs_queue[k+1]->tic) if (reqs_queue[k]->tic > reqs_queue[k + 1]->tic)
message("reqs_queue: %lld > %lld", reqs_queue[k]->tic, reqs_queue[k+1]->tic); message("reqs_queue: %lld > %lld", reqs_queue[k]->tic,
reqs_queue[k + 1]->tic);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment