Commit Graph

10 Commits

Author SHA1 Message Date
Ell 46a80811a8 app: implement GimpWaitable::try_wait() in GimpAsync 2018-05-29 16:04:28 -04:00
Ell e2c56ef407 app: implement GimpWaitable and GimpCancelable in GimpAsync
Have GimpAsync implement the GimpWaitable and GimpCancelable
interfaces, added in the previous two commits, instead of providing
its own public version of the corresponding functions.

Add gimp_async_cancel_and_wait() as a convenience function for both
canceling an async operation, and waiting for it to complete.

Adapt the rest of the code to the change.
2018-05-27 13:17:24 -04:00
Ell 770634f84e app: code cleanup in GimpAsync 2018-05-27 05:56:34 -04:00
Ell a901c3c1f4 app: various GimpAsync improvements
Improve the formalism of a GimpAsync object being "sycned"
(previously referred to as the main thread being "synced" with the
async thread), by both providing a gimp_async_is_synced() function,
separate from gimp_async_is_stopped(), and by improving the type
and function descriptions.

Make sure all previously added callbacks have been called after a
call to gimp_async_wait[_until](), even if these functions are
called from within a callback.
2018-05-26 14:21:51 -04:00
Ell 85f67e196c app: add gimp_async_remove_callback()
... which removes a callback previously added through
gimp_async_add_callback().
2018-05-26 14:21:51 -04:00
Ell 68c57548fd app: add gimp_async_wait_until()
... which is similar to gimp_async_wait(), taking an 'end_time'
parameter, controlling how long to wait for the async operation to
complete.
2018-05-26 11:32:34 -04:00
Ell 3c95928031 app: in GimpIScissorsTool, use sampler object ...
... instead of gegl_buffer_sample()

Ditto.
2018-05-13 19:40:46 -04:00
Ell 16a24ff081 app: various GimpAsync improvements
Code cleanup.

Improve function descriptions.

Improve function precondition checks.

Make sure the main thread is properly synced with the async thread
before calling the completion callbacks in the idle function.

Guarantee that all callbacks are called in FIFO order, even
callbacks added during the execution of other callbacks.
2018-05-13 15:21:28 -04:00
Ell 729240db34 app: improve GimpAsync description 2018-05-12 09:29:11 -04:00
Ell e1d15feff7 app: add GimpAsync
GimpAsync represents an asynchronous task, running without blocking
the main thread.  It provides functions that allow waiting for
completion, queueing completion callbacks, and requesting
calcelation.  See the code for more details.

The interface and the implementation are intentionally limited for
the time being, to keep things simple, and are geared toward
asynchronous tasks executed on a separate thread (see the next
commit).  The public interface is relatively general, however, and
we may extend the implementation to support other kinds of tasks at
some point, who knows...
2018-05-11 14:01:42 -04:00