AgsMainLoop

AgsMainLoop — toplevel threads

Functions

Signals

Types and Values

Object Hierarchy

    GInterface
    ╰── AgsMainLoop

Known Implementations

AgsMainLoop is implemented by AgsGenericMainLoop.

Includes

#include <ags/object/ags_main_loop.h>

Description

The AgsMainLoop interface gives you a unique access to toplevel threads.

Functions

ags_main_loop_get_tree_lock ()

pthread_mutex_t *
ags_main_loop_get_tree_lock (AgsMainLoop *main_loop);

Retrieve the tree mutex.

Parameters

main_loop

the AgsMainLoop

 

Returns

the mutex

Since: 2.0.0


ags_main_loop_set_application_context ()

void
ags_main_loop_set_application_context (AgsMainLoop *main_loop,
                                       AgsApplicationContext *application_context);

Sets the application context.

Parameters

main_loop

the AgsMainLoop

 

application_context

the AgsApplicationContext

 

Since: 2.0.0


ags_main_loop_get_application_context ()

AgsApplicationContext *
ags_main_loop_get_application_context (AgsMainLoop *main_loop);

Retrieve the AgsApplicationContext.

Parameters

main_loop

the AgsMainLoop

 

Returns

the AgsApplicationContext

Since: 2.0.0


ags_main_loop_set_async_queue ()

void
ags_main_loop_set_async_queue (AgsMainLoop *main_loop,
                               GObject *async_queue);

Sets the asynchronous queue.

Parameters

main_loop

the AgsMainLoop

 

async_queue

the AgsAsyncQueue

 

Since: 2.0.0


ags_main_loop_get_async_queue ()

GObject *
ags_main_loop_get_async_queue (AgsMainLoop *main_loop);

Retrieve the AgsAsyncQueue.

Parameters

main_loop

the AgsMainLoop

 

Returns

the AgsAsyncQueue

Since: 2.0.0


ags_main_loop_set_tic ()

void
ags_main_loop_set_tic (AgsMainLoop *main_loop,
                       guint tic);

Sets tic to tic .

Parameters

main_loop

the AgsMainLoop

 

tic

tic

 

Since: 2.0.0


ags_main_loop_get_tic ()

guint
ags_main_loop_get_tic (AgsMainLoop *main_loop);

Retrieve current tic of synchronization context.

Parameters

main_loop

the AgsMainLoop

 

Returns

current tic

Since: 2.0.0


ags_main_loop_set_last_sync ()

void
ags_main_loop_set_last_sync (AgsMainLoop *main_loop,
                             guint last_sync);

Sets last sync to last_sync .

Parameters

main_loop

the AgsMainLoop

 

last_sync

last sync

 

Since: 2.0.0


ags_main_loop_get_last_sync ()

guint
ags_main_loop_get_last_sync (AgsMainLoop *main_loop);

Retrieve last sync as tic of synchronization context.

Parameters

main_loop

the AgsMainLoop

 

Returns

last synced tic

Since: 2.0.0


ags_main_loop_interrupt ()

void
ags_main_loop_interrupt (AgsMainLoop *main_loop,
                         int sig,
                         guint time_cycle,
                         guint *time_spent);

Notify about interrupt threads.

Parameters

main_loop

the AgsMainLoop

 

sig

the singal number

 

time_cycle

the amount of time of a cycle

 

time_spent

the amount of time passed since last cycle

 

Since: 2.0.0


ags_main_loop_monitor ()

gboolean
ags_main_loop_monitor (AgsMainLoop *main_loop,
                       guint time_cycle,
                       guint *time_spent);

Notify to monitor time.

Parameters

main_loop

the AgsMainLoop

 

time_cycle

the amount of time of a cycle

 

time_spent

the amount of time passed since last cycle

 

Returns

if monitor is allowed

Since: 2.0.0


ags_main_loop_change_frequency ()

void
ags_main_loop_change_frequency (AgsMainLoop *main_loop,
                                gdouble frequency);

Change frequency.

Parameters

main_loop

the AgsMainLoop

 

frequency

the new frequency

 

Since: 2.0.0


ags_main_loop_sync_counter_inc ()

void
ags_main_loop_sync_counter_inc (AgsMainLoop *main_loop,
                                guint tic);

test sync counter.

Parameters

main_loop

the AgsMainLoop

 

tic

the current tic

 

Returns

TRUE if synced, otherwise FALSE

Since: 2.2.10


ags_main_loop_sync_counter_dec ()

void
ags_main_loop_sync_counter_dec (AgsMainLoop *main_loop,
                                guint tic);

Decrement sync counter.

Parameters

main_loop

the AgsMainLoop

 

tic

the current tic

 

Since: 2.2.10


ags_main_loop_sync_counter_test ()

gboolean
ags_main_loop_sync_counter_test (AgsMainLoop *main_loop,
                                 guint tic);

ags_main_loop_set_sync_tic ()

void
ags_main_loop_set_sync_tic (AgsMainLoop *main_loop,
                            guint sync_tic);

Set current tic of sync counter.

Parameters

main_loop

the AgsMainLoop

 

tic

the current sync tic

 

Since: 2.2.15


ags_main_loop_get_sync_tic ()

guint
ags_main_loop_get_sync_tic (AgsMainLoop *main_loop);

Retrieve current tic of sync counter.

Parameters

main_loop

the AgsMainLoop

 

Returns

current sync tic

Since: 2.2.15


AGS_IS_MAIN_LOOP()

#define AGS_IS_MAIN_LOOP(obj)                 (G_TYPE_CHECK_INSTANCE_TYPE((obj), AGS_TYPE_MAIN_LOOP))

AGS_IS_MAIN_LOOP_INTERFACE()

#define AGS_IS_MAIN_LOOP_INTERFACE(vtable)    (G_TYPE_CHECK_CLASS_TYPE((vtable), AGS_TYPE_MAIN_LOOP))

AGS_MAIN_LOOP()

#define AGS_MAIN_LOOP(obj)                    (G_TYPE_CHECK_INSTANCE_CAST((obj), AGS_TYPE_MAIN_LOOP, AgsMainLoop))

AGS_MAIN_LOOP_GET_INTERFACE()

#define AGS_MAIN_LOOP_GET_INTERFACE(obj)      (G_TYPE_INSTANCE_GET_INTERFACE((obj), AGS_TYPE_MAIN_LOOP, AgsMainLoopInterface))

AGS_MAIN_LOOP_INTERFACE()

#define AGS_MAIN_LOOP_INTERFACE(vtable)       (G_TYPE_CHECK_CLASS_CAST((vtable), AGS_TYPE_MAIN_LOOP, AgsMainLoopInterface))

ags_main_loop_get_type ()

GType
ags_main_loop_get_type ();

Types and Values

AGS_TYPE_MAIN_LOOP

#define AGS_TYPE_MAIN_LOOP                    (ags_main_loop_get_type())

AgsMainLoop

typedef struct _AgsMainLoop AgsMainLoop;

struct AgsMainLoopInterface

struct AgsMainLoopInterface {
  GTypeInterface ginterface;
  
  pthread_mutex_t* (*get_tree_lock)(AgsMainLoop *main_loop);
  
  void (*set_application_context)(AgsMainLoop *main_loop, AgsApplicationContext *application_context);
  AgsApplicationContext* (*get_application_context)(AgsMainLoop *main_loop);

  void (*set_async_queue)(AgsMainLoop *main_loop, GObject *async_queue);
  GObject* (*get_async_queue)(AgsMainLoop *main_loop);
  
  void (*set_tic)(AgsMainLoop *main_loop, guint tic);
  guint (*get_tic)(AgsMainLoop *main_loop);

  void (*set_last_sync)(AgsMainLoop *main_loop, guint last_sync);
  guint (*get_last_sync)(AgsMainLoop *main_loop);

  void (*interrupt)(AgsMainLoop *main_loop,
		    int sig,
		    guint time_cycle, guint *time_spent);
  gboolean (*monitor)(AgsMainLoop *main_loop,
		      guint time_cycle, guint *time_spent);

  void (*change_frequency)(AgsMainLoop *main_loop,
			   gdouble frequency);

  void (*sync_counter_inc)(AgsMainLoop *main_loop, guint tic);
  void (*sync_counter_dec)(AgsMainLoop *main_loop, guint tic);
  gboolean (*sync_counter_test)(AgsMainLoop *main_loop, guint tic);

  void (*set_sync_tic)(AgsMainLoop *main_loop, guint sync_tic);
  guint (*get_sync_tic)(AgsMainLoop *main_loop);
};

Signal Details

The “change-frequency” signal

void
user_function (AgsMainLoop *main_loop,
               gdouble      frequency,
               gpointer     user_data)

Change frequency.

Parameters

main_loop

the AgsMainLoop

 

frequency

the new frequency

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since: 2.0.0


The “interrupt” signal

void
user_function (AgsMainLoop *main_loop,
               gint         sig,
               guint        time_cycle,
               gpointer     time_spent,
               gpointer     user_data)

Notify about interrupt threads.

Parameters

main_loop

the AgsMainLoop

 

sig

the signal number

 

time_cycle

the amount of time of a cycle

 

time_spent

the amount of time passed since last cycle

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since: 2.0.0


The “monitor” signal

gboolean
user_function (AgsMainLoop *main_loop,
               guint        time_cycle,
               gpointer     time_spent,
               gpointer     user_data)

Notify to monitor time.

Parameters

main_loop

the AgsMainLoop

 

time_cycle

the amount of time of a cycle

 

time_spent

the amount of time passed since last cycle

 

user_data

user data set when the signal handler was connected.

 

Returns

if monitor is allowed

Flags: Run Last

Since: 2.0.0