On Thu, 24 Sep 2009 16:28:58 -0400 Jim Hodapp <[email protected]> wrote: > > That's a good tip, I am inheriting from sigc::trackable for the > Emsac class. This might be part of the problem. If I don't inherit > from sigc::trackable, what's the proper way of cleaning up the > functor slot? > > Thanks, > > Jim
Sorry, our e-mail fetching and dispatching is too quick and we are trading misaligned e-mails! Ah well, if you are trying to create slots representing non-static methods of an object deriving from sigc::trackable in two different threads, then you are in trouble. This is a real trap for the unwary when using libsigc++ in multi-threaded programs. An alternative is the boost::signal2 library, which is thread safe, (not boost::signal, which isn't) although I have own (much simpler) one which I use when thread safety is important which I can send you if you want. Otherwise you need to do it by hand. Be careful though that sigc::connection is not thread-safe either. To clean up a functor slot not connected to a sigc::signal object, you can just let it go out of scope (if a local object) or call delete on it (if it is allocated on freestore). If the latter, make sure it was created in the same thread as the one which deletes it if it represents a non-static method of an object deriving from sigc::trackable. Chris _______________________________________________ gtkmm-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/gtkmm-list
