Function
GLibThreadtry_new
Declaration
GThread*
g_thread_try_new (
const gchar* name,
GThreadFunc func,
gpointer data,
GError** error
)
Description
This function is the same as g_thread_new()
except that
it allows for the possibility of failure.
If a thread can not be created (due to resource limits),
error
is set and NULL
is returned.
Available since: | 2.32 |
Parameters
name
-
Type:
const gchar*
An (optional) name for the new thread.
The argument can be NULL
.The data is owned by the caller of the function. The value is a NUL terminated UTF-8 string. func
-
Type:
GThreadFunc
A function to execute in the new thread.
data
-
Type:
gpointer
An argument to supply to the new thread.
The argument can be NULL
.The data is owned by the caller of the function. error
-
Type:
GError **
The return location for an error.
The argument can be NULL
.The argument will be set to NULL
by the function if there are no errors.In case of error, the argument will be set and the caller will take ownership of the data, and be responsible for freeing it.
Return value
Type: GThread
The new GThread
, or NULL
if an error occurred.
The caller of the function takes ownership of the data, and is responsible for freeing it. |