Skip to content

Commit

Permalink
Per reviewer comments: switched lock and unlock
Browse files Browse the repository at this point in the history
  • Loading branch information
davidBar-On committed Apr 25, 2024
1 parent 0731b5e commit 49c7aef
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/iperf_error.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ iperf_errexit(struct iperf_test *test, const char *format, ...)
}
iperf_json_finish(test);
} else {
if (pthread_mutex_unlock(&(test->print_mutex)) != 0) {
perror("iperf_errexit: pthread_mutex_unlock");
if (pthread_mutex_lock(&(test->print_mutex)) != 0) {
perror("iperf_errexit: pthread_mutex_lock");
}

if (test && test->outfile && test->outfile != stdout) {
Expand All @@ -127,8 +127,8 @@ iperf_errexit(struct iperf_test *test, const char *format, ...)
fprintf(stderr, "iperf3: %s\n", str);
}

if (pthread_mutex_lock(&(test->print_mutex)) != 0) {
perror("iperf_errexit: pthread_mutex_lock");
if (pthread_mutex_unlock(&(test->print_mutex)) != 0) {
perror("iperf_errexit: pthread_mutex_unlock");
}
}

Expand Down

0 comments on commit 49c7aef

Please sign in to comment.