## AgsReturnableThread

AgsReturnableThread — returnable thread

## Stability Level

Stable, unless otherwise indicated

## Functions

#define | AGS_RETURNABLE_THREAD_GET_RESET_MUTEX()
void | (*AgsReturnableThreadCallback) ()
gboolean | ags_returnable_thread_test_flags ()
void | ags_returnable_thread_set_flags ()
void | ags_returnable_thread_unset_flags ()
void | ags_returnable_thread_safe_run ()
void | ags_returnable_thread_connect_safe_run ()
void | ags_returnable_thread_disconnect_safe_run ()
AgsReturnableThread * | ags_returnable_thread_new ()

## Properties

GObject * | thread-pool | Read / Write

## Signals

void | safe-run | Run Last

## Types and Values

#define | AGS_RETURNABLE_THREAD_DEFAULT_JIFFIE
enum | AgsReturnableThreadFlags

## Object Hierarchy

        GFlags
        ╰── AgsReturnableThreadFlags
        GObject
        ╰── AgsThread
            ╰── AgsReturnableThread

## Includes

    #include <ags/thread/ags_returnable_thread.h>

## Description

The AgsReturnableThread acts as thread. It should return after a short while because of limited thread pool.

## Functions

### AGS_RETURNABLE_THREAD_GET_RESET_MUTEX()

    #define AGS_RETURNABLE_THREAD_GET_RESET_MUTEX(obj) (&(((AgsReturnableThread *) obj)->reset_mutex))

### AgsReturnableThreadCallback ()

    void
    (*AgsReturnableThreadCallback) (AgsReturnableThread *returnable_thread,
                                    gpointer data);

### ags_returnable_thread_test_flags ()

    gboolean
    ags_returnable_thread_test_flags (AgsReturnableThread *returnable_thread,
                                      AgsReturnableThreadFlags flags);

Test `flags` to be set on `returnable_thread` .

#### Parameters

returnable_thread | the AgsReturnableThread |
flags | the flags |

#### Returns

`TRUE` if flags are set, else `FALSE`

Since: 3.0.0

### ags_returnable_thread_set_flags ()

    void
    ags_returnable_thread_set_flags (AgsReturnableThread *returnable_thread,
                                     AgsReturnableThreadFlags flags);

Set flags.

#### Parameters

returnable_thread | the AgsReturnableThread |
flags | the flags |

Since: 3.0.0

### ags_returnable_thread_unset_flags ()

    void
    ags_returnable_thread_unset_flags (AgsReturnableThread *returnable_thread,
                                       AgsReturnableThreadFlags flags);

Unset flags.

#### Parameters

returnable_thread | the AgsReturnableThread |
flags | the flags |

Since: 3.0.0

### ags_returnable_thread_safe_run ()

    void
    ags_returnable_thread_safe_run (AgsReturnableThread *returnable_thread);

### ags_returnable_thread_connect_safe_run ()

    void
    ags_returnable_thread_connect_safe_run
                                   (AgsReturnableThread *returnable_thread,
                                    AgsReturnableThreadCallback callback);

Connects `callback` to `thread` .

#### Parameters

returnable_thread | the thread to connect |
callback | the callback. | [scope call]

Since: 3.0.0

### ags_returnable_thread_disconnect_safe_run ()

    void
    ags_returnable_thread_disconnect_safe_run
                                   (AgsReturnableThread *returnable_thread);

Disconnects callback of `thread` .

#### Parameters

returnable_thread | the thread to disconnect |

Since: 3.0.0

### ags_returnable_thread_new ()

    AgsReturnableThread *
    ags_returnable_thread_new (GObject *thread_pool);

Create a new instance of AgsReturnableThread.

#### Parameters

thread_pool | the AgsThreadPool |

#### Returns

the new AgsReturnableThread

Since: 3.0.0

## Types and Values

### AGS_RETURNABLE_THREAD_DEFAULT_JIFFIE

    #define AGS_RETURNABLE_THREAD_DEFAULT_JIFFIE (AGS_THREAD_DEFAULT_MAX_PRECISION)

### enum AgsReturnableThreadFlags

Enum values to control the behavior or indicate internal state of AgsReturnableThread by enable/disable as flags.

#### Members

AGS_RETURNABLE_THREAD_IN_USE | the thread is in use |
AGS_RETURNABLE_THREAD_RESET | not used |
AGS_RETURNABLE_THREAD_RUN_ONCE | call AgsThread::`run()` only one time |

## Property Details

### The `“thread-pool”` property

      “thread-pool”              GObject *

The assigned AgsThreadPool providing default settings.

Owner: AgsReturnableThread

Flags: Read / Write

Since: 3.0.0

## Signal Details

### The `“safe-run”` signal

    void
    user_function (AgsReturnableThread *returnable_thread,
                   gpointer             user_data)

The ::safe-run is invoked durin AgsThread::run as a context safe wrapper.

#### Parameters

returnable_thread | the AgsReturnableThread |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 3.0.0