You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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. GioFutures 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.
The text was updated successfully, but these errors were encountered:
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 withgio::JoinHandle
; I’m speaking of the futures one), it callsg_source_destroy
, which stops the future from being scheduled on the CPU (guaranteed immediately, as far as I can tell, if you’re callingabort
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 theTaskSource
), 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 theJoinHandle
is dropped. This seems really unintuitive: I would definitely have expectedJoinHandle::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.
The text was updated successfully, but these errors were encountered: