Thread.try


Description:

[ Version ( since = "2.32" ) ]
[ CCode ( cname = "g_thread_try_new" ) ]
public Thread.try (string? name, owned ThreadFunc<T> func) throws Error

This function is the same as Thread except that it allows for the possibility of failure.

If a thread can not be created (due to resource limits), throws is set and null is returned.

Parameters:

name

an (optional) name for the new thread

func

a function to execute in the new thread

data

an argument to supply to the new thread

Returns:

the new Thread, or null if an error occurred