Request that the worker thread call func
with the data
argument, much like
submit_job, but waits (starting a MainLoop) for a
maximum of timeout_ms
miliseconds for func
to be executed.
If this function is called from within this's worker thread, then this function simply calls func
with data
and does not use context
.
The following cases are possible if this function is not called from within this's worker thread: <
itemizedlist> <listitem><para>the call to func
took less than timeout_ms
miliseconds: the return
value is true and out_result
contains the result of the func
's execution,
and out_job_id
contains null. Note in this case that throws
may still contain an error code if func
's execution produced an error. Also note that in this case any setting
defined by set_callback is not applied (as the result is immediately returned)
</para></listitem> <listitem><para>The call to func
takes more then timeout_ms
miliseconds: the return value is true and out_result
is null
and out_job_id
contains the ID of the job as if it had been submitted using
submit_job. If out_job_id
is null,
and if no setting has been defined using set_callback, then the job will be
discarded (as if forget_job had been called). </para></listitem>
<listitem><para>The call to func
could not be done (some kind of plumbing error for instance): the returned value
is false and out_result
and out_job_id
are set to
null (if they are not null)</para></listitem> <
/itemizedlist>
Notes: <itemizedlist> <listitem><para>result_destroy_func
is needed in case out_result
is
null (to avoid memory leaks)</para></listitem> <listitem><para>passing
null for context
is similar to passing the result of
ref_thread_default</para></listitem> </itemizedlist>
this |
a Worker object |
context |
a MainContext to execute a main loop in (while waiting), or null |
timeout_ms |
the maximum number of milisecons to wait before returning, or 0 for unlimited wait |
out_result |
a place to store the result, if any, of |
out_job_id |
a place to store the ID of the job having been submitted, or null |
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 |
true if no error occurred |