Re: Signals in threads



A bit late on the discussion, but I did a wrapper method on Glib::Dispatcher that allows for a worker thread to call a method/function on the GUI thread, and wait for the results (it waits on a mutex+block signals in the meanwhile). The usage interface, on the worker thread, is like this:

    // update the interface
    gui_callback( sigc::mem_fun( *mywin, &MyWindow::update_status ) );

If the worker thread can wait a short time (typically) for the GUI thread to update, this is simple and  thread safe.

If interested let me know, I can send you the class for you to copy&paste from, or use as is -- it's LGPL and should be in source forge as soon as I finish the first working version of my project.

- jan


----- Original Message ----
From: Mike Polan <kanadakid gmail com>
To: gtkmm-list gnome org; paul linuxaudiosystems com
Sent: Thursday, June 22, 2006 4:34:53 PM
Subject: Re: Signals in threads

Thanks for the suggestions; Glib::Dispatcher did the trick nicely. Along with that, g_async_queue, as Dave mentioned before, does work very well in this situation in terms of keeping data free of corruption.

Once again, thanks!
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list



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