Sorts the given array by comparing with the specified compare function, in parallel. The sort is stable.
Note. With nullable primitive types, this method produces an undesirable result if the compare function is not specified. you should provide specified compare function to get a proper result.
int?[] array = {5, 4, 3, 2, 1};
parallel_sort<int?>(array).wait();
// => the result is undesirable, such as 5, 2, 1, 3, 4
int?[] array2 = {5, 4, 3, 2, 1};
parallel_sort<int?>(array2, (a, b) => {
if (a == null) return -1;
else if (b == null) return 1;
else return a < b ? -1 : (a == b ? 0 : 1);
}).wait();
// => the result is 1, 2, 3, 4, 5
array |
a gpointer array to be sorted |
compare |
compare function to compare elements. if it is not specified, the result of Gee.Functions.get_compare_func_for is used |
a future which will be completed with a null value if the sort succeeds, or with an exception if the sort fails because an error is thrown from the compare function |