-
-
Notifications
You must be signed in to change notification settings - Fork 129
Description
I’m not sure if this is something that is intended behaviour but would be worth documenting better, or something that is not intended behaviour and would be worth fixing, but here goes.
When you call glib::JoinHandle::abort
(not to be confused with gio::JoinHandle
; I’m speaking of the futures one), it calls g_source_destroy
, which stops the future from being scheduled on the CPU (guaranteed immediately, as far as I can tell, if you’re calling abort
from the same thread on which the future normally runs). However, while it destroys the source, it does not unref the source, which means the future is not actually dropped (because the future is held inside the TaskSource
), which means any objects held inside the future (e.g. GioFuture
s for ongoing async operations) are also not dropped, which means those async operations carry on going. It seems that the future is not actually dropped until the JoinHandle
is dropped. This seems really unintuitive: I would definitely have expected JoinHandle::abort
to drop the future (either within itself or on the next iteration of the main loop).
This might be somewhat related to GH-46 but it’s not quite the same thing.