Re: AW: Is Disptacher-functionality Gtkmm only?
- From: Chris Vine <chris cvine freeserve co uk>
- To: gtkmm-list gnome org
- Cc:
- Subject: Re: AW: Is Disptacher-functionality Gtkmm only?
- Date: Sun, 1 Jan 2006 11:24:52 +0000
On Sunday 01 January 2006 08:20, Daniel Kraft wrote:
> Hi!
>
> > On Saturday 31 December 2005 15:51, Daniel Kraft wrote:
> > > Hi!
> > >
> > > My system seems to have some problems with idle signals and the
> > > Dispatcher class (as I priviously posted); therefore I used pure GTK+
> > > for idle signals, and it worked.
> > >
> > > Now I wanted to try the same for Dispatcher, but I couldn't find the
> > > GTK+ equivalent! Is that a Gtkmm-added feature? If so, has anyone an
> > > idea how to do the same in GTK+ (although this is the wrong mailing
> > > list)?
> >
> > Glib::Dispatcher doesn't use idle signals. It uses a pipe to communicate
> > between threads. It is specific to glibmm (it does not have an
> > equivalent in glib), but you can easily make your own with a pipe and a
> > GIOChannel object. If you have a problem with Glib::Dispatcher, it is
> > almost certainly a coding error in your code and not a problem with
> > either glibmm or your "system".
>
> My original problem was really that my Gtkmm-installation didn't work
> correctly (as I use Cygwin, which seems to be a bit unusual system) - even
> the Dispatcher examples were broken.
>
> Thank you for your solution! I think this should work for me.
Oh, I see. If you want a glib-based (not glibmm) C++ solution you could try:
http://cvs.sourceforge.net/viewcvs.py/efax-gtk/efax-gtk/src/utils/notifier.h?rev=1.6
http://cvs.sourceforge.net/viewcvs.py/efax-gtk/efax-gtk/src/utils/notifier.cpp?rev=1.4
And to make sense of the code you would also need this pipe wrapper (but you
could easily modify the code not to use the wrapper):
http://cvs.sourceforge.net/viewcvs.py/efax-gtk/efax-gtk/src/utils/pipes.h?rev=1.5
http://cvs.sourceforge.net/viewcvs.py/efax-gtk/efax-gtk/src/utils/pipes.cpp?rev=1.2
and also, unless you were to modify the code to use a GIOChannel object rather
than a slightly lower overhead custom GSource object, these:
http://cvs.sourceforge.net/viewcvs.py/efax-gtk/efax-gtk/src/utils/io_watch.h?rev=1.3
http://cvs.sourceforge.net/viewcvs.py/efax-gtk/efax-gtk/src/utils/io_watch.cpp?rev=1.2
This code also uses libsigc++ for the callback, but you could use a simple
function object or indeed a function pointer instead for the callback if
wanted. (I imagine however that you can compile libsigc++ OK as the
libsigc++ documentation says that it works with both cygwin and .NET 2003.)
The code also uses a pthread-based mutex to ensure atomicity between threads
writing to the (single) notifier pipe, for which you can substitute the glib
GThread mutex.
Anyway, this might give you some ideas.
Chris
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]