Re: Removing widgets in the main loop from another thread
- From: Damon Register <damon w register lmco com>
- To: gtkmm-list gnome org
- Subject: Re: Removing widgets in the main loop from another thread
- Date: Thu, 14 May 2009 11:17:52 -0400
Chris Vine wrote:
object whose method is being executed via Glib::Dispatcher. Deriving
that object from sigc::trackable would avoid executing (via a signal)
one of its non-static methods after it has ceased to exist; but it would
not prevent a segfault when the main loop tries to look-up the (by then
not-existing) Glib::Dispatcher object to try to execute the signal
object it used to keep.
See this for further discussion:
http://mail.gnome.org/archives/gtkmm-list/2008-January/msg00048.html
I am working on a small test app in order to understand how to use
Glib::Thread. I have read the Glib::Thread reference at
http://www.gtkmm.org/docs/glibmm-2.4/docs/reference/html/classGlib_1_1Thread.html
and have also found a few gtkmm-list discussions such as this one.
The problem is that I am still struggling to understand the issue with
sigc::trackable not being thread safe.
In this example at
http://www.gtkmm.org/docs/glibmm-2.4/docs/reference/html/thread_2thread_8cc-example.html
I see that MessageQueue is derived from sigc::trackable. This appears to
be a violation of what the class ref says
Because sigc::trackable is not thread safe, if the slot represents a non-static class
method (that is, it is created by sigc::mem_fun()), the class concerned should not
derive from sigc::trackable.
Is the example program thread safe? If it is thread safe, how is this
not a violation of what the class ref says? How would I change it
to be unsafe? Certainly I don't want to do that but I want to understand
what not to do.
If the example is not thread safe, how would it be change to be safe?
Damon Register
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]