Skip to content

Commit

Permalink
Fix: Fix potential dead lock
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnoStiefvater authored and nichtsfrei committed Jan 13, 2022
1 parent 40f176d commit 3ac3ed2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion boreas/sniffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,14 +317,14 @@ start_sniffer_thread (scanner_t *scanner, pthread_t *sniffer_thread_id)
}

/* Start sniffer thread. */
pthread_mutex_lock (&mutex);
err = pthread_create (sniffer_thread_id, NULL, sniffer_thread, scanner);
if (err == EAGAIN)
g_warning ("%s: pthread_create() returned EAGAIN: Insufficient resources "
"to create thread.",
__func__);

/* Wait for thread to start up before sending out pings. */
pthread_mutex_lock (&mutex);
pthread_cond_wait (&cond, &mutex);
pthread_mutex_unlock (&mutex);
/* Mutex and cond not needed anymore. */
Expand Down

0 comments on commit 3ac3ed2

Please sign in to comment.