| 3626 | NTHREADS threads. */ |
| 3627 | |
| 3628 | static void |
| 3629 | queue_init (struct merge_node_queue *queue, size_t nthreads) |
| 3630 | { |
| 3631 | /* Though it's highly unlikely all nodes are in the heap at the same |
| 3632 | time, the heap should accommodate all of them. Counting a null |
| 3633 | dummy head for the heap, reserve 2 * NTHREADS nodes. */ |
| 3634 | queue->priority_queue = heap_alloc (compare_nodes, 2 * nthreads); |
| 3635 | pthread_mutex_init (&queue->mutex, NULL); |
| 3636 | pthread_cond_init (&queue->cond, NULL); |
| 3637 | } |
| 3638 | |
| 3639 | /* Insert NODE into QUEUE. The caller either holds a lock on NODE, or |
| 3640 | does not need to lock NODE. */ |