Skip to content

[th/connectivity-use-gsource] connectivity: use GSource pointer for curl_timer instead of numeric source-id

Thomas Haller requested to merge th/connectivity-use-gsource into main

I think GSource* is preferable, because it's more type-safe than the guint numbers. Also, g_source_remove() only works with g_main_context_default(), while g_source_detach() of a GSource pointer works with any GMainContext (so it's more general, even if we in this case only have sources attached to g_main_context_default()).

Handling GSource* pointers is possibly also faster, since it saves one extra g_main_context_find_source_by_id() -- on the other hand, tracking the pointer costs 8 bytes while tracking the guint only costs 4 bytes. Whether it's faster is unproven, but possibly it is. In any case it's not an argument against using pointers.

Anyway. Update another usage of source-ids to use GSource pointers. This is also the pattern that "" suggests.

Merge request reports