Make this execute the func
function with the arg
argument (along with a
Error which is not error
) in the sub thread managed by this.
To execute a function which does not return anything, use execute_void.
This method returns immediately, and the caller then needs to use fetch_result to check if the execution has finished and get the result.
Once func
's execution is finished, if arg
is not null
, the arg_destroy_func
destruction function is called on arg
. This call occurs in the thread calling
fetch_result.
If an error occurred in this function, then the arg_destroy_func
function is not called to free arg
.
this |
a ThreadWrapper object |
func |
the function to execute, not |
arg |
argument to pass to |
arg_destroy_func |
function to be called when the execution has finished, to destroy |
the job ID, or 0 if an error occurred |