Skip to content

Commit

Permalink
[tests] remove unnecessary shutdown locking
Browse files Browse the repository at this point in the history
the test should be in charge not to shutdown too much at once

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
  • Loading branch information
fabbione committed Feb 3, 2020
1 parent 65e818b commit d63926d
Showing 1 changed file with 0 additions and 19 deletions.
19 changes: 0 additions & 19 deletions libknet/tests/test-common.c
Expand Up @@ -33,8 +33,6 @@ struct log_thread_data {
FILE *std;
};
static struct log_thread_data data;
static pthread_mutex_t shutdown_mutex = PTHREAD_MUTEX_INITIALIZER;
static int stop_in_progress = 0;

static int _read_pipe(int fd, char **file, size_t *length)
{
Expand Down Expand Up @@ -376,29 +374,12 @@ knet_handle_t knet_handle_start(int logfds[2], uint8_t log_level)

int knet_handle_stop(knet_handle_t knet_h)
{
int savederrno;
size_t i, j;
knet_node_id_t host_ids[KNET_MAX_HOST];
uint8_t link_ids[KNET_MAX_LINK];
size_t host_ids_entries = 0, link_ids_entries = 0;
struct knet_link_status status;

savederrno = pthread_mutex_lock(&shutdown_mutex);
if (savederrno) {
printf("Unable to get shutdown mutex lock\n");
return -1;
}

if (stop_in_progress) {
pthread_mutex_unlock(&shutdown_mutex);
errno = EINVAL;
return -1;
}

stop_in_progress = 1;

pthread_mutex_unlock(&shutdown_mutex);

if (!knet_h) {
errno = EINVAL;
return -1;
Expand Down

0 comments on commit d63926d

Please sign in to comment.