AgsAsyncQueue

AgsAsyncQueue — asynchronous run

Functions

Types and Values

Object Hierarchy

    GInterface
    ╰── AgsAsyncQueue

Known Implementations

AgsAsyncQueue is implemented by AgsRemoteTaskThread and AgsTaskThread.

Includes

#include <ags/object/ags_async_queue.h>

Description

The AgsAsyncQueue interface determines a thread-safe/collision-free slot. The implementation shall run tasks in a safe context.

Functions

ags_async_queue_increment_wait_ref ()

void
ags_async_queue_increment_wait_ref (AgsAsyncQueue *async_queue);

Increments wait ref.

Parameters

async_queue

the AgsAsyncQueue

 

Since: 2.0.0


ags_async_queue_get_wait_ref ()

guint
ags_async_queue_get_wait_ref (AgsAsyncQueue *async_queue);

Get wait ref.

Parameters

async_queue

the AgsAsyncQueue

 

Returns

The number of threads waiting.

Since: 2.0.0


ags_async_queue_set_run_mutex ()

void
ags_async_queue_set_run_mutex (AgsAsyncQueue *async_queue,
                               pthread_mutex_t *run_mutex);

Sets the mutex to access the condition variable.

Parameters

async_queue

the AgsAsyncQueue

 

run_mutex

a pthread_mutex_t

 

Since: 2.0.0


ags_async_queue_get_run_mutex ()

pthread_mutex_t *
ags_async_queue_get_run_mutex (AgsAsyncQueue *async_queue);

Get the mutex to access the condition variable.

Parameters

async_queue

the AgsAsyncQueue

 

Returns

a pthread_mutex_t

Since: 2.0.0


ags_async_queue_set_run_cond ()

void
ags_async_queue_set_run_cond (AgsAsyncQueue *async_queue,
                              pthread_cond_t *run_cond);

Sets the condition to determine if async_queue was run.

Parameters

async_queue

the AgsAsyncQueue

 

run_cond

a pthread_cond_t

 

Since: 2.0.0


ags_async_queue_get_run_cond ()

pthread_cond_t *
ags_async_queue_get_run_cond (AgsAsyncQueue *async_queue);

Get the condition to wait for async_queue .

Parameters

async_queue

the AgsAsyncQueue

 

Returns

the pthread_cond_t

Since: 2.0.0


ags_async_queue_set_run ()

void
ags_async_queue_set_run (AgsAsyncQueue *async_queue,
                         gboolean is_run);

Determine if you are allowed to pass the condition.

Parameters

async_queue

the AgsAsyncQueue

 

is_run

if TRUE the queue was already running

 

Since: 2.0.0


ags_async_queue_is_run ()

gboolean
ags_async_queue_is_run (AgsAsyncQueue *async_queue);

Decide if you are allowed to pass the condition.

Parameters

async_queue

the AgsAsyncQueue

 

Returns

if TRUE it is safe to continue, else you should wait for the condition.

Since: 2.0.0


ags_async_queue_schedule_task ()

void
ags_async_queue_schedule_task (AgsAsyncQueue *async_queue,
                               GObject *task);

Schedule task to be launched in a safe context.

Parameters

async_queue

the AgsAsyncQueue

 

task

the task object

 

Since: 2.0.0


ags_async_queue_schedule_task_list ()

void
ags_async_queue_schedule_task_list (AgsAsyncQueue *async_queue,
                                    GList *list);

Schedule task_list to be launched in a safe context.

Parameters

async_queue

the AgsAsyncQueue

 

task_list

a list of task objects

 

Since: 2.0.0


AGS_ASYNC_QUEUE()

#define AGS_ASYNC_QUEUE(obj)                    (G_TYPE_CHECK_INSTANCE_CAST((obj), AGS_TYPE_ASYNC_QUEUE, AgsAsyncQueue))

AGS_ASYNC_QUEUE_GET_INTERFACE()

#define AGS_ASYNC_QUEUE_GET_INTERFACE(obj)      (G_TYPE_INSTANCE_GET_INTERFACE((obj), AGS_TYPE_ASYNC_QUEUE, AgsAsyncQueueInterface))

AGS_ASYNC_QUEUE_INTERFACE()

#define AGS_ASYNC_QUEUE_INTERFACE(vtable)       (G_TYPE_CHECK_CLASS_CAST((vtable), AGS_TYPE_ASYNC_QUEUE, AgsAsyncQueueInterface))

AGS_IS_ASYNC_QUEUE()

#define AGS_IS_ASYNC_QUEUE(obj)                 (G_TYPE_CHECK_INSTANCE_TYPE((obj), AGS_TYPE_ASYNC_QUEUE))

AGS_IS_ASYNC_QUEUE_INTERFACE()

#define AGS_IS_ASYNC_QUEUE_INTERFACE(vtable)    (G_TYPE_CHECK_CLASS_TYPE((vtable), AGS_TYPE_ASYNC_QUEUE))

ags_async_queue_get_type ()

GType
ags_async_queue_get_type ();

Types and Values

AGS_TYPE_ASYNC_QUEUE

#define AGS_TYPE_ASYNC_QUEUE                    (ags_async_queue_get_type())

AgsAsyncQueue

typedef struct _AgsAsyncQueue AgsAsyncQueue;

struct AgsAsyncQueueInterface

struct AgsAsyncQueueInterface {
  GTypeInterface ginterface;
  
  void (*increment_wait_ref)(AgsAsyncQueue *async_queue);
  guint (*get_wait_ref)(AgsAsyncQueue *async_queue);

  void (*set_run_mutex)(AgsAsyncQueue *async_queue, pthread_mutex_t *run_mutex);
  pthread_mutex_t* (*get_run_mutex)(AgsAsyncQueue *async_queue);

  void (*set_run_cond)(AgsAsyncQueue *async_queue, pthread_cond_t *run_cond);
  pthread_cond_t* (*get_run_cond)(AgsAsyncQueue *async_queue);

  void (*set_run)(AgsAsyncQueue *async_queue, gboolean is_run);
  gboolean (*is_run)(AgsAsyncQueue *async_queue);

  void (*schedule_task)(AgsAsyncQueue *async_queue, GObject *task);
  void (*schedule_task_list)(AgsAsyncQueue *async_queue, GObject *task);
};