The main loop property

AgsApplicationContext:main-loop does usually point to an AgsThread implementing AgsMainLoop interface. provides you the AgsGenericMainLoop object or if you intend to use, this property shall point to AgsAudioLoop.

AgsMainLoop interface

As it shall be implemented by AGS_TYPE_THREAD subtypes, this parent object provides a mutex to properly lock the object. You should obtain the pthread_mutex_t pointer by calling pthread_mutex_t* ags_mutex_manager_lookup(AgsMutexManager*, GObject*).

The main loop specifies some signals like ::interrupt, ::monitor and ::change-frequency. They are all related to realtime behavior of an application. Assumed you have a thread you want to run within the thread tree, but it is not mandatory to run it. With these functions you can determine if you shall pause your thread during ::interrupt signal. How many time you are allowed to consume or running at all, can be concluded by using ::monitor. In order to get notified about modified refreshing rate of your thread, listen to ::change-frequency signal.

The interface provides some other function pointers. If you want to provide AgsTaskThread to your application, use void ags_main_loop_set_async_queue(AgsMainLoop*, GObject*) and GObject* ags_main_loop_get_async_queue(AgsMainLoop*).

To control the AgsThread::clock signal AgsMainLoop's methods are going to be invoked. The involved functions are:

  • void ags_main_loop_set_tic(AgsMainLoop*, guint)
  • guint ags_main_loop_get_tic(AgsMainLoop*)
  • void ags_main_loop_set_last_sync(AgsMainLoop*, guint)
  • guint ags_main_loop_get_last_sync(AgsMainLoop*)