On Thursday, 11 June 2020 at 06:13:59 UTC, adnan338 wrote:
On Thursday, 11 June 2020 at 06:05:09 UTC, adnan338 wrote:
I would like to set a callback for the `download()` function but I do not seem to find a way to add a callback to the procedure.

[...]

I have also been told that Gtk is not thread safe. What does this mean and does it effect me on this scenario?

That means that you must not access GTK objects from anything but your mainthread, so e.g. spawning a new thread to listen for progress on the curl request and updating the thread directly from there wont work. You could use glib.Idle or glib.Timeout to listen for updates in your mainthread without blocking it. In case you need to do something heavier (e.g. decode a big response) you probably want to do that in a separate thread to not block your mainthread (and as such make your UI unresponsive while the decoding blocks the thread). In that case I'd recommend using message passing, meaning that you spawn a separate thread, do your decoding there and then send the result back to your mainthread and manipulate the GTK widget there.

Reply via email to