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 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 string is a NUL terminated UTF-8 string.
func GThreadFunc
 

A function to execute in the new thread.

data gpointer
 

An argument to supply to the new thread.

error GError **
  The return location for a GError*, or NULL.

Return value

Returns: 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.