Re: Threads and gtkmm



Thanks for the info. I was still using g_idle_connect with static methods to communicate between threads…

I have a question on how to transmit the dispatcher to an object. The documentation seems to indicate that the default copy constructor and operator are used. Does this mean that I can send my dispatcher object to other objects directly ?
MyClass
{
	public:
		MyClass(const Glib::Dispatcher &d):
			dispatcher(d)
		{ }
	private:
		Glib::Dispatcher dispatcher;
{ }

Or shall I use a pointer (or a reference) (that can be dangerous depending on the destruction order of the objects) ?
MyClass
{
	public:
		MyClass(Glib::Dispatcher *d):
			dispatcher(d)
		{ }
	private:
		Glib::Dispatcher *dispatcher;
}

Thanks,
yann


On 16/03/2011 23:41, Chris Vine wrote:
Hi,

In order to deal in part with the issues thrown up by the bug report at
https://bugzilla.gnome.org/show_bug.cgi?id=512348 , I have agreed to
contribute a new section to the gtkmm tutorial on writing
multi-threaded programs using gtkmm.  This will reduce the risk of too
many people writing thread unsafe code because of the (partly hidden)
problems associated with libsigc++.

The text set out below (which for ease of reading is at this stage in
plain text rather than formatted XML) is drawn from my own experience in
writing multi-threaded code and in going through the tedious business of
inspecting libsigc++ in order to determine what is safe and what is
not. However, I know I am not the only person to have been faced with
this so if anyone else has any gotchas which they have come across and
which I have not mentioned, or suggestions arising from their own
experience, I would like to hear about them.

Regards,

Chris


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