• Ell's avatar
    app: add gimp_parallel_run_async_{full,independent}() · b74e600c
    Ell authored
    Remove the "independent" parameter of gimp_parallel_run_async(),
    and have the function always execute the passed callback in the
    shared async thread-pool.
    Add a new gimp_parallel_run_async_full() function, taking, in
    addition to a callback and a data pointer:
      - A priority value, controlling the priority of the callback in
        the async thread-pool queue.  0 is the default priority (used
        by gimp_parallel_run_async()), negative values have higher
        priority, and positive values have lower priority.
      - A destructor function for the data pointer.  This function is
        called to free the user data in case the async operation is
        canceled before execution of the callback function begins, and
        the operation is dropped from the queue and aborted without
        executing the callback.  Note that if the callback *is*
        executed, the destructor is *not* used -- it's the callback's
        responsibility to free/recycle the user data.
    Add a separate gimp_parallel_run_async_independent() function,
    taking the same parameters, and executing the passed callback in
    an independent thread, rather than the thread pool.  This function
    doesn't take a priority value or a destructor (and there's no
    corresponding "_full()" variant that does), since they're pointless
    for independent threads.
    Adapt the rest of the code to the changes.
gimp-parallel.cc 18.3 KB