Re: keep an io_channel from wasting my time?



On Fri, Dec 13, 2002 at 08:28:10PM -0500, Havoc Pennington wrote:
> Hi,
> 
> Questions about using GTK should go to gtk-list or gtk-app-devel-list,
> not this list.
> 
> On Fri, Dec 13, 2002 at 07:07:17PM -0500, Jeff Abrahamson wrote:
> > What I'd like is for the output handler not to be called unless both
> > the descriptor is ready *and* there's data to write.
> 
> Is it going to read your mind? ;-)
> 
> It has no way of knowing if your app wants to write data...

No, but a variable contains the amount of stuff to write. I was hoping
the main loop could key off of additional criteria, although it didn't
look like it could.


> > Perhaps the only solution is for the output handler to de-register
> > itself every time the work queue empties and to have the enqueue
> > operation re-register the handler. But this seems a horrible kludge.
> 
> This is how it's supposed to work - you add the output handler only
> when you have stuff to output.

So then the queue_output function would contain code that says

    if(!output_handler_registered)
        g_io_add_watch(gout, G_IO_OUT, do_output, mel);

and the output handler itself would contain code that says

    if(more_to_write)
        return 0;
    return 1;


Maybe that's not a kludge, it just wasn't what I expected...

Thanks.

-- 
 Jeff

 Jeff Abrahamson  <http://www.purple.com/jeff/>
 GPG fingerprint: 1A1A BA95 D082 A558 A276  63C6 16BF 8C4C 0D1D AE4B

Attachment: pgpxqmXaYCzBx.pgp
Description: PGP signature



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