Re: gtkmm-list Digest, Vol 196, Issue 3



Ok, yeah, I guess I didn't quite make it that far in the docs!

Nice find :)

I have updated my test project to use signal_idle().connect_once(). That appears to work as expected, no need for queues!

I suppose it could still be worth using a queue if you were planning on streaming back data from another thread, instead of just using the thread as a worker that triggers its own callbacks.

https://github.com/Blquinn/idlequeue/tree/sig-idle

I think it would also be a good idea to have an example of using connect_once in the docs, I think the callback method is probably quite a common workflow.

-Ben

On Sun, Sep 13, 2020 at 8:00 AM <gtkmm-list-request gnome org> wrote:
Send gtkmm-list mailing list submissions to
        gtkmm-list gnome org

To subscribe or unsubscribe via the World Wide Web, visit
        https://mail.gnome.org/mailman/listinfo/gtkmm-list
or, via email, send a message with subject or body 'help' to
        gtkmm-list-request gnome org

You can reach the person managing the list at
        gtkmm-list-owner gnome org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of gtkmm-list digest..."


Today's Topics:

   1. Re: Invoking GTK main thread from other threads (Daniel Boles)
   2. Re: Invoking GTK main thread from other threads (Daniel Boles)


----------------------------------------------------------------------

Message: 1
Date: Sat, 12 Sep 2020 14:40:52 +0100
From: Daniel Boles <dboles src gmail com>
Cc: gtkmm-list <gtkmm-list gnome org>
Subject: Re: Invoking GTK main thread from other threads
Message-ID:
        <CAKChMKOcYF1tUzFkwrEf4=zWhr_46r4ufrJZ3-BmJU8TrKPOXQ mail gmail com>
Content-Type: text/plain; charset="utf-8"

Yeah, that doc did it for me: it seems that sigc++ makes glibmm less thread
safe than GLib itself here. So I have some rewriting to do!

Thanks for the links and discussion :-)

> Although glib is itself thread-safe, any glibmm wrappers which use
libsigc++ will not be. So for example, only the thread in which a main loop
runs should call Glib::SignalIdle::connect(),
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.gnome.org/archives/gtkmm-list/attachments/20200912/8a27bc95/attachment.html>

------------------------------

Message: 2
Date: Sat, 12 Sep 2020 14:44:25 +0100
From: Daniel Boles <dboles src gmail com>
To: gtkmm-list <gtkmm-list gnome org>
Subject: Re: Invoking GTK main thread from other threads
Message-ID:
        <CAKChMKN92giz6NNq6dK=HQ_7syRBXorSdd61poPXMCxOtSBSVg mail gmail com>
Content-Type: text/plain; charset="utf-8"

Or maybe it's not so bad, since I usually only need to do things once, when
the main thread resumes, and that sounds OK. Phew! :-D

> The connect*_once() variants, Glib::SignalIdle::connect_once(),
Glib::SignalTimeout::connect_once(),
Glib::SignalTimeout::connect_seconds_once(), are thread-safe for any case
where the slot is not created by a call to sigc::mem_fun() which represents
a method of a class deriving from sigc::trackable.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.gnome.org/archives/gtkmm-list/attachments/20200912/0184a5e0/attachment.html>

------------------------------

Subject: Digest Footer

_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


------------------------------

End of gtkmm-list Digest, Vol 196, Issue 3
******************************************


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]