deprecated: 2.32 since: 2.10


g_thread_foreach (
  GFunc thread_func,
  gpointer user_data


Call thread_func on all GThreads that have been created with g_thread_create().

Note that threads may decide to exit while thread_func is running, so without intimate knowledge about the lifetime of foreign threads, thread_func shouldn’t access the GThread* pointer passed in as first argument. However, thread_func will not be called for threads which are known to have exited already.

Due to thread lifetime checks, this function has an execution complexity which is quadratic in the number of existing threads.

Available since: 2.10

Deprecated since: 2.32

There aren’t many things you can do with a GThread, except comparing it with one that was returned from g_thread_create(). There are better ways to find out if your thread is still alive.

This function is not directly available to language bindings.



Type: GFunc

Function to call for all GThread structures.


Type: gpointer

Second argument to thread_func.

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