AgsReturnableThread

AgsReturnableThread — returnable thread

Synopsis

#include <ags/thread/ags_returnable_thread.h>

#define             AGS_RETURNABLE_THREAD_DEFAULT_JIFFIE
struct              AgsReturnableThread;
void                (*AgsReturnableThreadCallback)      (AgsReturnableThread *returnable_thread,
                                                         gpointer data);
struct              AgsReturnableThreadClass;
enum                AgsReturnableThreadFlags;
void                ags_returnable_thread_connect_safe_run
                                                        (AgsReturnableThread *returnable_thread,
                                                         AgsReturnableThreadCallback callback);
void                ags_returnable_thread_disconnect_safe_run
                                                        (AgsReturnableThread *returnable_thread);
AgsReturnableThread * ags_returnable_thread_new         (GObject *thread_pool);
void                ags_returnable_thread_safe_run      (AgsReturnableThread *returnable_thread);

Description

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

Details

AGS_RETURNABLE_THREAD_DEFAULT_JIFFIE

#define AGS_RETURNABLE_THREAD_DEFAULT_JIFFIE (1000)

struct AgsReturnableThread

struct AgsReturnableThread {
  AgsThread thread;

  volatile guint flags;

  GObject *thread_pool;

  pthread_mutex_t reset_mutex;
  volatile void *safe_data;

  gulong handler;
};

AgsReturnableThreadCallback ()

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

struct AgsReturnableThreadClass

struct AgsReturnableThreadClass {
  AgsThreadClass thread;

  void (*safe_run)(AgsReturnableThread *returnable_thread);
};

enum AgsReturnableThreadFlags

typedef enum {
  AGS_RETURNABLE_THREAD_IN_USE              = 1,
  AGS_RETURNABLE_THREAD_RESET               = 1 << 1,
} AgsReturnableThreadFlags;

ags_returnable_thread_connect_safe_run ()

void                ags_returnable_thread_connect_safe_run
                                                        (AgsReturnableThread *returnable_thread,
                                                         AgsReturnableThreadCallback callback);

Connects callback to thread.

returnable_thread :

the thread to connect

callback :

the callback

Since 0.4


ags_returnable_thread_disconnect_safe_run ()

void                ags_returnable_thread_disconnect_safe_run
                                                        (AgsReturnableThread *returnable_thread);

Disconnects callback of thread.

returnable_thread :

the thread to disconnect

Since 0.4


ags_returnable_thread_new ()

AgsReturnableThread * ags_returnable_thread_new         (GObject *thread_pool);

Create a new AgsReturnableThread.

thread_pool :

the AgsThreadPool

Returns :

the new AgsReturnableThread

Since 0.4


ags_returnable_thread_safe_run ()

void                ags_returnable_thread_safe_run      (AgsReturnableThread *returnable_thread);