On 20-06-2020 18:34, adnan338 wrote:

Hello, I need a code review on my strategy of updating a GtkD progressbar. Gtk is not thread safe, I interpret that as "I must only access data available in the main thread from the Gtk objects".

This example is a simplified excerpt of my project. I have never done concurrency before and thus I would like a code review. The goal here is

  1. Downloading a list of file in parallel
  2. Update the gtk progressbar periodically to show the overall download progress.
......

Original thread: https://forum.dlang.org/post/kqvpjwbkpravywaldiof@forum.dlang.org

Using glib.Timeout or glib.Idle is probably the best approach to update
the main thread/GUI.

If you are worried about a data race you could use, std.concurrency.send
and std.concurrency.receiveTimeout.