Skip to content

Commit

Permalink
Fix race condition on process listing
Browse files Browse the repository at this point in the history
Previously the process listing had a race condition where it could
deallocate the queue before the process discovery thread ended its
job.  This commit fix this by checking if the thread ended before
destroying the queue.

Signed-off-by: Giuliano Belinassi <[email protected]>
  • Loading branch information
giulianobelinassi committed Apr 10, 2024
1 parent 3342f6c commit 22bc882
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tools/patches.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,11 @@ process_list_end(struct ulp_process_iterator *it)
{
if (it->now == NULL) {
release_ulp_process(it->last);
producer_consumer_delete(it->pcqueue);
if (enable_threading) {
/* Make sure the threads stopped before destroying the queue. */
pthread_join(process_list_thread, NULL);
}
producer_consumer_delete(it->pcqueue);

/* In case threads were disabled because of some special case, then enable
it now. */
Expand Down

0 comments on commit 22bc882

Please sign in to comment.