Re: [gtk-list] Re: gdk_io_* clarification
- From: James Macnicol <jamesm evans ee adfa oz au>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: gdk_io_* clarification
- Date: Mon, 5 Apr 99 11:58:18 EST
> > 1. Program asks to be notified of data ready to read
> > 2. Data becomes available
> > 3. Handler that was registered with gdk_input_add_full is called
> > 4. Data is read
> > 5. Program now asks for read and write notification (still in handler)
> > 6. Handler returns
> > 7. Destroy notify is called (for reasons I don't understand)
> > 8. Program just sits there forever
I'm very sorry, but I missed something important ... step 5.5
in the above is that destroy notify is called immediately
gdk_input_remove() is called, as you might expect. The problem seems
to me that it is being called twice -- the first time immediately
after gdk_input_remove() is called and then again (for the new tag)
after the original handler returns.
> The destroy notify sounds perfectly fine to me ... you call
> gdk_input_remove() on a input handler that you added with
> gdk_input_add_full() and when the callback remove, your DestroyNotify
> is called.
See above. Sorry again for not putting this in the first time.
> I'm not completely sure why the program should "sit there forever"...
> If you strace the process, is it selecting on the appropriate
> file descriptors?
Erm, I'm not sure how to tell that. This is Solaris and truss on
the process in question has :
miranda(0):~% truss -p 515
poll(0x0806D550, 4, -1) (sleeping...)
The reason I say "sits there forever" is that the program goes
back to the gtk event loop but notification on my file descriptor has
been turned off (which is the mystery here) and so given the current
way my program works is to do nothing until some sort of notification
is received, it just doesn't do anything at all.
BTW, the NNTP server is reporting the connection to my program
is okay, so the problem is not that it has refused to serve my program
and has disconnected.
> > I'm a bit suspicious that the gdk_input_remove(),
> > gdk_input_add_full() method of changing the notifications on that file
> > descriptor but I don't see any other way to do it.
>
> Why not use separate GDK_INPUT_READ and GDK_INPUT_WRITE handlers?
Everything gets routed into a C++ class anyway (the data
pointer to gdk_input_add_full() is a pointer to a class where the
appropriate method then gets called). Separate handlers wouldn't
advantage my application much, but I could try it if you think it'd
help.
I'll see if I can cook up a little example you can point at
any NNTP server.
--
James Macnicol
j-macnicol@adfa.edu.au
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]