GNOME Bugzilla – Bug 658763
GCancellable should not use an fd
Last modified: 2017-10-24 11:34:15 UTC
cf. bug 658743, GCancellable's direct use of GWakeup is a bit unfortunate. It means that leaking GCancellable in your program will pretty quickly result in a crash due to running out of file descriptors. Instead of using GWakeup for each GCancellable we should try to structure the cancellable source such that it uses the GWakeup of the main context to which it is attached. We should then deprecate the functions that deal with file descriptors and GPollFD.
(In reply to comment #0) > Instead of using GWakeup for each GCancellable we should try to structure the > cancellable source such that it uses the GWakeup of the main context to which > it is attached. doesn't this go against the plan of deprecating prepare/check funcs? > We should then deprecate the functions that deal with file descriptors and > GPollFD. note that GUnixInputStream, GUnixOutputStream, and GSocket make use of g_cancellable_make_pollfd() without using GMainContext.
The deprecation of check/prepare funcs comes with the introduction of a function to set the monotonic time after which the source should be considered ready. The solution here (as with idle sources) is just to set that to 'now'.
This was fixed as bug #680121. *** This bug has been marked as a duplicate of bug 680121 ***