Function

GLibThreadcreate

deprecated: 2.32 

Declaration

GThread*
g_thread_create (
  GThreadFunc func,
  gpointer data,
  gboolean joinable,
  GError** error
)

Description

This function creates a new thread.

The new thread executes the function func with the argument data. If the thread was created successfully, it is returned.

error can be NULL to ignore errors, or non-NULL to report errors. The error is set, if and only if the function returns NULL.

This function returns a reference to the created thread only if joinable is TRUE. In that case, you must free this reference by calling g_thread_unref() or g_thread_join(). If joinable is FALSE then you should probably not touch the return value.

Deprecated since: 2.32

Use g_thread_new() instead.

This function is not directly available to language bindings.

Parameters

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.
joinable

Type: gboolean

Should this thread be joinable?

error

Type: GError **

The return location for a recoverable error.

The argument can be NULL.
If the return location is not NULL, then you must initialize it to a NULL GError*.
The argument will left initialized to NULL by the function if there are no errors.
In case of error, the argument will be set to a newly allocated GError; the caller will take ownership of the data, and be responsible for freeing it.

Return value

Type: GThread

The new GThread on success.

The caller of the function takes ownership of the data, and is responsible for freeing it.