submit_job
Description:
public uint submit_job (MainContext? callback_context, owned WorkerFunc func, DestroyNotify? data_destroy_func) throws Error
Request that the worker thread call func
with the data
argument.
Notes: <itemizedlist> <listitem><para>if data_destroy_func
is not null, then
it will be called to destroy data
when the job is removed, which can occur within the context of the worker thread, or within the
context of any thread using this.</para></listitem> <listitem><para>if
result_destroy_func
is not null, then it will be called to destroy the result produced by func
. Similarly to data_destroy_func
, if it is not null (and if there is a non
null result), then that function can be called in the context of any thread.</para></listitem>
<listitem><para>the error here can only report failures while executing submit_job, not any error which
may occur while executing func
from the worker thread.</para></listitem> <listitem><para>when this
function returns, the job may already have been completed, so you should not assume that the job is in any specific state.</para><
/listitem> <listitem><para>passing null for callback_context
is similar to
passing the result of ref_thread_default</para><
/listitem> </itemizedlist>
Parameters:
this |
a Worker object |
callback_context |
a MainContext, or null (ignored if no setting has been defined with set_callback) |
func |
the function to call from the worker thread |
data_destroy_func |
a function to destroy |
data |
the data to pass to |
result_destroy_func |
a function to destroy the result, if any, of the execution of |
Returns:
a job ID, or 0 if an error occurred |