newsAdvanced Gtk+ Sequencer - News: Refactored key c source files

 
 
Latest News
GSequencer v3.0.4 - new major release arrived posted by jkraehemann, Sun 19 Jan 2020 12:19:27 AM UTC - 0 replies
GSequencer v3.0.0 alpha release posted by jkraehemann, Mon 30 Dec 2019 09:45:27 PM UTC - 0 replies
GSequencer v3.0.0 has got support for libsoup2.4 XMLRPC posted by jkraehemann, Thu 12 Dec 2019 06:28:37 PM UTC - 0 replies
GSequencer v3.0.0 planned release date 2020-05-07 posted by jkraehemann, Wed 20 Nov 2019 08:15:08 AM UTC - 0 replies
Advanced Gtk+ Sequencer v2.4.0 released posted by jkraehemann, Sat 02 Nov 2019 05:15:23 PM UTC - 0 replies
[Submit News]
[92 news in archive]

Refactored key c source files

Item posted by Joël Krähemann <jkraehemann> on Thu 19 Apr 2018 06:49:50 PM UTC.

Wow, it is really a lot of work to rework the entire code base. In case you missed it, here is what I do for short:

  • make all objects thread-safe "the user" interacts with
  • replace existing locks looked-up on the mutex manager by per-class locks

Most objects get additional fields like:

  pthread_mutex_t *obj_mutex;
  pthread_mutexattr_t *obj_mutexattr;

You should be able to access these fields as having the per-class lock. E.g. the newly introduced AgsPluginPort has following function:

pthread_mutex_t* ags_plugin_port_get_class_mutex();

In theory you only access the obj_mutex field as having the class mutex lock. For the plugin port it would look like this:

  pthread_mutex_t *plugin_port_mutex;

  plugin_port = AGS_PLUGIN_PORT(gobject);

  /* get base plugin mutex */
  pthread_mutex_lock(ags_plugin_port_get_class_mutex());

  plugin_port_mutex = plugin_port->obj_mutex;

  pthread_mutex_unlock(ags_plugin_port_get_class_mutex());

The code above is from ags_plugin_port_get_property() function. Note, strings should basically been duplicated as it is just a pointer to a memory location.

Thread-safe key objects

So far, I reworked the key source files:

  • ags_audio.c
  • ags_channel.c
  • ags_recycling.c
  • ags_audio_signal.c
  • ags_recall.c
  • ags_recall_factory.c
  • ...

Since the objects inheriting of AgsRecall need to lock the object, too. There is still much to do. Further AgsRecall got better semantics of processing stages. The process first/last flags was just removed because it is not needed, anymore.

There are some considerations that the engine won't perform as desired. However, the advantage of more intuitive locking mechanism is evident.

The situation in 1.4.x is basically magic. This shall change.


by Joël

No messages in Refactored key c source files

 

Back to the top


Powered by Savane 3.5