sort


Description:

[ Version ( since = "2.10" ) ]
public void sort (CompareDataFunc<G> func)

Sorts this using func.

The sort function func is passed two elements of the this. It should return 0 if they are equal, a negative value if the first element should be higher in the this or a positive value if the first element should be lower in the this than the second element.

This function will lock this 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:

 gint32 id1;
gint32 id2;

id1 = GPOINTER_TO_INT (element1);
id2 = GPOINTER_TO_INT (element2);

return (id1 > id2 ? +1 : id1 == id2 ? 0 : -1);

Parameters:

this

a AsyncQueue

func

the CompareDataFunc is used to sort this

user_data

user data passed to func