The sort function func is passed two elements of the queue.
It should return 0 if they are equal, a negative value if the
first element should be higher in the queue or a positive value
if the first element should be lower in the queue than the second
element.
This function will lock queue before it sorts the queue and unlock
it when it is finished.
If you were sorting a list of priority numbers to make sure the
lowest priority would be at the top of the queue, you could use:
Sorts queue using func.
The sort function func is passed two elements of the queue. It should return 0 if they are equal, a negative value if the first element should be higher in the queue or a positive value if the first element should be lower in the queue than the second element.
This function will lock queue before it sorts the queue and unlock it when it is finished.
If you were sorting a list of priority numbers to make sure the lowest priority would be at the top of the queue, you could use: