Re: Glib::Dispatcher and data transfer into main loop
- From: klaus triendl <klaus triendl eu>
- To: Andreas Volz <lists brachttal net>
- Cc: gtkmm-list gnome org
- Subject: Re: Glib::Dispatcher and data transfer into main loop
- Date: Sun, 20 Apr 2008 22:20:26 +0200
Andreas Volz schrieb:
Am Sat, 19 Apr 2008 20:33:43 +0200 schrieb klaus triendl:
Andreas Volz schrieb:
Hello,
I'm using a Glib::Dispatcher to dispatch data from a thread into my
main loop. This is my code:
[snip]
Any ideas how to solve that problem? I've seen no way to give data
to the dispatchSignal() call. So I need a member variable to
transfer data from the thread called function to the dispatched
function. I could think of a queue that saves all the incoming data
from the thread for later use in the dispatched function. Do you
think that's the best way to do it? Any other ideas?
Did you see my post a few days ago about interthread communication
with sigx?
The library would solve exactly your problem (and it does indeed put
the incoming data into a message queue).
cMan could create a signal to which other threads can connect. The
signal can have any number of parameters (up to sigc's arity).
Very interesting! The sigx library seems to be very young. Is it yet
tested on win32?
sigx is young, that's right. The example and test programs run on
windows, too.
And I use it in the firewall application "fireflier" (which is inactive
at the moment, though).
Its advantage is that the dispatcher message queue that you invented
again are encapsulated in a functor and signal interface in a threadsafe
manner and once you derive your classes from sigx facilities, everything
is easy to use.
You can take a look at sigx's example program to get a good idea how to
use the library.
--
klaus triendl
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]