On 01/14/2014 12:22 AM, Shayan Pooya wrote: > Valgrind reported two race conditions when I ran sort on a small file. > Both of them seem to be legitimate. > --- > src/sort.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/src/sort.c b/src/sort.c > index 3380be6..e6658e6 100644 > --- a/src/sort.c > +++ b/src/sort.c > @@ -3354,8 +3354,8 @@ queue_insert (struct merge_node_queue *queue, struct > merge_node *node) > pthread_mutex_lock (&queue->mutex); > heap_insert (queue->priority_queue, node); > node->queued = true; > - pthread_mutex_unlock (&queue->mutex); > pthread_cond_signal (&queue->cond); > + pthread_mutex_unlock (&queue->mutex); > } > > /* Pop the top node off the priority QUEUE, lock the node, return it. */ > @@ -3950,7 +3950,7 @@ sort (char *const *files, size_t nfiles, char const > *output_file, > sortlines (line, nthreads, buf.nlines, root, > &queue, tfp, temp_output); > queue_destroy (&queue); > - pthread_mutex_destroy (&root->lock); > + pthread_mutex_destroy (&merge_tree->lock); > merge_tree_destroy (merge_tree); > } > else
Hi, what version of valgrind, command line options, and sort input files did you use. thanks, Pádraig.
