Package: gio
Class gio:cancellable
Superclassesgobject:object, common-lisp:standard-object, common-lisp:t Documented Subclasses
None
Direct Slots
None
Details The gio:cancellable object allows operations to be cancelled. The g:cancellable object is a thread-safe operation cancellation
stack used throughout GIO to allow for cancellation of synchronous and
asynchronous operations. Signal DetailsThe "cancelled" signallambda (cancellable) :run-last
Note that disconnecting from this signal, or any signal, in a multi-threaded program is prone to race conditions. For instance it is possible that a signal handler may be invoked even after a call to the g:signal-handler-disconnect function for that handler has already returned. There is also a problem when cancellation happen right before connecting to the signal. If this happens the signal will unexpectedly not be emitted, and checking before connecting to the signal leaves a race condition where this is still happening. In order to make it safe and easy to connect handlers there are two helper functions: the g:cancellable-connect and g:cancellable-disconnect functions which protect against problems like this. An example of how to us this: /* Make sure we don't do any unnecessary work if already cancelled */ if (g_cancellable_set_error_if_cancelled (cancellable)) return; /* Set up all the data needed to be able to * handle cancellation of the operation */ my_data = my_data_new (...);Note that the cancelled signal is emitted in the thread that the user cancelled from, which may be the main thread. So, the cancellable signal should not do something that can block. | Inherited Slot Access Functions |
2025-1-30