wakeup
Description:
Wake up this if it’s currently blocking in [method@GLib.
MainContext.iteration], causing it to stop blocking.
The this could be blocking waiting for a source to become ready. Otherwise, if this is not currently blocking, this function causes the next invocation of [method@GLib.MainContext.iteration] to return without blocking.
This API is useful for low-level control over [struct@GLib.MainContext]; for example, integrating it with main loop implementations such as [ struct@GLib.MainLoop].
Another related use for this function is when implementing a main loop with a termination condition, computed from multiple threads:
```c define NUM_TASKS 10 static gint tasks_remaining = NUM_TASKS; // (atomic) ...
while (g_atomic_int_get (&tasks_remaining) != 0) g_main_context_iteration (NULL, TRUE); ```
Then in a thread: ```c perform_work ();
if (g_atomic_int_dec_and_test (&tasks_remaining)) g_main_context_wakeup (NULL); ```
Parameters:
| this |
a main context (if `NULL`, the global-default main context will be used) |