Re: Sending slots to main thread (implemented)
- From: <joaquinduran adtelecom es>
- To: joaquinduran adtelecom es, Chris Vine <chris cvine freeserve co uk>
- Cc: gtkmm-list <gtkmm-list gnome org>
- Subject: Re: Sending slots to main thread (implemented)
- Date: Sat, 01 Sep 2007 15:52:57 +0200
On Sat Sep 1 14:38 , Chris Vine sent:
>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 >) 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.)
An smart pointer is not needed. An slot is a very small structure thats stores a pointer to a
dynamic allocated one that stores the parameters with the function pointer.
(I haven't take a look to sigc++ library but I think that it is implemented in this way)
To avoid the inclussion of many unrelated stuff in this e-amil, I hope next monday to answer
your previous e-mail (it is on my working computer). Sorry for the delay.
>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.
Thanks but I think that my proposed class is working fine.
Note on Dispatcher class, I've taken a closer look to its interface. I've seen that the
connect member function returns a sigc::connection object. this means that the signal could be
disconnected from dispatcher and another one be connected.
sigc::conecttion connect = dispatcher.connect(sigc::mem_func(*this, example::func1param,
sigc::conecttion connect = dispatcher.connect(sigc::mem_func(*this, example::secondfunction,
Thanks and Best Regards,
] [Thread Prev