execute


Description:

[ Version ( since = "4.2" ) ]
public uint execute (owned ThreadWrapperFunc func, void* arg) throws Error

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.

Parameters:

this

a ThreadWrapper object

func

the function to execute, not null

arg

argument to pass to func, or null

arg_destroy_func

function to be called when the execution has finished, to destroy arg, or null

Returns:

the job ID, or 0 if an error occurred