## AgsMainLoop

AgsMainLoop — main loop interface

## Stability Level

Stable, unless otherwise indicated

## Functions

GRecMutex * | ags_main_loop_get_tree_lock ()
void | ags_main_loop_set_syncing ()
gboolean | ags_main_loop_is_syncing ()
void | ags_main_loop_set_critical_region ()
gboolean | ags_main_loop_is_critical_region ()
void | ags_main_loop_inc_queued_critical_region ()
void | ags_main_loop_dec_queued_critical_region ()
guint | ags_main_loop_test_queued_critical_region ()
void | ags_main_loop_change_frequency ()

## Signals

void | change-frequency | Run Last

## Object Hierarchy

        GInterface
        ╰── AgsMainLoop

## Includes

    #include <ags/object/ags_main_loop.h>

## Description

The AgsMainLoop interface gives you a unique access to the main loop.

## Functions

### ags_main_loop_get_tree_lock ()

    GRecMutex *
    ags_main_loop_get_tree_lock (AgsMainLoop *main_loop);

Retrieve the tree mutex.

#### Parameters

main_loop | the AgsMainLoop |

#### Returns

the mutex.

[transfer none]

Since: 3.0.0

### ags_main_loop_set_syncing ()

    void
    ags_main_loop_set_syncing (AgsMainLoop *main_loop,
                               gboolean is_syncing);

Set thread tree is syncing.

#### Parameters

main_loop | the AgsMainLoop |
is_syncing | set `TRUE` if syncing |

Since: 3.0.0

### ags_main_loop_is_syncing ()

    gboolean
    ags_main_loop_is_syncing (AgsMainLoop *main_loop);

Check if thread tree is syncing.

#### Parameters

main_loop | the AgsMainLoop |

#### Returns

`TRUE` if sync in progress, otherwise `FALSE`

Since: 3.0.0

### ags_main_loop_set_critical_region ()

    void
    ags_main_loop_set_critical_region (AgsMainLoop *main_loop,
                                       gboolean is_critical_region);

Set main loop is in critical region.

#### Parameters

main_loop | the AgsMainLoop |
is_critical_region | set `TRUE` if critical region |

Since: 3.0.0

### ags_main_loop_is_critical_region ()

    gboolean
    ags_main_loop_is_critical_region (AgsMainLoop *main_loop);

Check if main loop is in critical region.

#### Parameters

main_loop | the AgsMainLoop |

#### Returns

`TRUE` if sync in progress, otherwise `FALSE`

Since: 3.0.0

### ags_main_loop_inc_queued_critical_region ()

    void
    ags_main_loop_inc_queued_critical_region
                                   (AgsMainLoop *main_loop);

Increment thread needs access to main loop's critical region field.

#### Parameters

main_loop | the AgsMainLoop |

Since: 3.0.0

### ags_main_loop_dec_queued_critical_region ()

    void
    ags_main_loop_dec_queued_critical_region
                                   (AgsMainLoop *main_loop);

Decrement thread needs access to main loop's critical region field.

#### Parameters

main_loop | the AgsMainLoop |

Since: 3.0.0

### ags_main_loop_test_queued_critical_region ()

    guint
    ags_main_loop_test_queued_critical_region
                                   (AgsMainLoop *main_loop);

Test main loop may enter critical region.

#### Parameters

main_loop | the AgsMainLoop |

#### Returns

0 if main loop may enter critical region, otherwise not

Since: 3.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: 3.0.0

## Signal Details

### The `“change-frequency”` signal

    void
    user_function (AgsMainLoop *main_loop,
                   double       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: 3.0.0