### Function

# GLib Thread exit

#### Declaration

    void
    g_thread_exit (
      gpointer retval
    )

#### Description

Terminates the current thread.

If another thread is waiting for us using `g_thread_join()` then the waiting thread will be woken up and get `retval` as the return value of g_thread_join().

Calling `g_thread_exit()` with a parameter `retval` is equivalent to returning `retval` from the function `func`, as given to g_thread_new().

You must only call `g_thread_exit()` from a thread that you created yourself with `g_thread_new()` or related APIs. You must not call this function from a thread created with another threading library or or from within a `GThreadPool`.

#### Parameters

`retval`

  Type: `gpointer`

  The return value of this thread.

  The argument can be `NULL`.
  The data is owned by the caller of the function.