Skip to content

gmain: Refactor idle-once and timeout-once to avoid a closure allocation

Philip Withnall requested to merge pwithnall/glib:source-once-no-allocs into main

Instead store a bit inside GTimeoutSource and GIdleSource to indicate that they are one-shot sources, and that their callbacks have a different type and should always be assumed to return G_SOURCE_REMOVE.

This should make one-shot idle and timeout sources a teeny weeny little bit cheaper to set up.

From a suggestion here: !2684 (comment 1462917)

Signed-off-by: Philip Withnall pwithnall@endlessos.org

Merge request reports