Re: Sending slots to main thread (implemented)

On Thu, 2007-08-30 at 21:06 +0100, Chris Vine wrote:

> In any event, if you do want to pass an entire slot to the queue, I
> suspect it would be more efficient to have a pointer to a slot (or
> shared_ptr<sigc::slot<void> >) as the contained element -
> boost::shared_ptr for example has a thread-safe reference count. (I
> don't know how much is involved in copying slots by value and whether
> this would in fact comprise a performance advantage for this usage.)

This reminds me that message passing to the main program thread in GTK+
is normally done using g_idle_add() (which is thread safe) and there was
a proposal to make the Glib::SignalIdle::connect() wrapper thread safe
with a new Glib::SignalIdle::connect_once() function.  I don't know if
Daniel has got anywhere with that

You can however use the unwrapped g_idle_add() for passing your
callbacks to the thread in which the default programme GMainContext is
running, if you want.


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