Method

GLibThreadPoolset_sort_function

Declaration

void
g_thread_pool_set_sort_function (
  GThreadPool* pool,
  GCompareDataFunc func,
  gpointer user_data
)

Description

Sets the function used to sort the list of tasks. This allows the tasks to be processed by a priority determined by func, and not just in the order in which they were added to the pool.

Note, if the maximum number of threads is more than 1, the order that threads are executed cannot be guaranteed 100%. Threads are scheduled by the operating system and are executed at random. It cannot be assumed that threads are executed in the order they are created.

Available since:2.10
This method is not directly available to language bindings.

Parameters

func GCompareDataFunc
 

The GCompareDataFunc used to sort the list of tasks. This function is passed two tasks. It should return 0 if the order in which they are handled does not matter, a negative value if the first task should be processed before the second or a positive value if the second task should be processed first.

user_data gpointer
 

User data passed to func.

 The argument can be NULL.
 The data is owned by the caller of the function.