Re: [gnet] Re: GIOChannels, GNet, GOIO



On Sat, 2004-05-15 at 00:45 +0100, Joel Becker wrote:
> On Fri, May 14, 2004 at 06:12:32PM -0500, James M. Cape wrote:
> > Well, the standing policy is that no duplicate functionality goes into
> > the GNOME platform without deprecating the existing means, so this means
> 
> 	This depends on whether the functionality is a pure duplication.
> 
> > Perhaps the plain "IO source watching" functionality could be exposed as
> > a simple GSource, which is in turn used by the IOstream object. Then
> > those who merely want source watching can get it without the baggage of
> > an object, whereas those who want to use a stream object can use one.
> 
> 	I'm not worried about the mere allocation of a GObject.  I'm
> quite comfortable with that, in fact.  What I am worried about is a
> stack of these things, forming a nice tower of code passing that is, in
> a word, awful.  SysV STREAMS is my example.
> 	Consider the simple "here's my fd, please watch in GMainLoop
> and let me call read_chars() in my callback".  In GIOChannel, there is a
> GIOChannel structure allocated, it happily registers your callbacks, and
> g_io_channel_get_chars() does the right thing (mere copy to your buffer
> if you turn off encoding conversion).
> 	If a GOIO object is similar in its intrusion, there will be no
> problem.  But if it is significantly larger (alloced size or codepath),
> or if I have to create a stack of the things, I'm going to be unhappy.
> 
> Joel

For the simple cases of reading NULL-encoded data from a file, that is
all that's required. For Gio as of right now, doing what GIOChannel does
is a simple matter of 

stream = gio_file_stream_new_from_handle (fd);
gio_stream_open (stream, &err);
bytes_read = gio_stream_read (stream, buffer, sizeof (buffer), &err);
gio_stream_close (stream, &err);

or

gio_stream_start_read (stream, func, data, notify);

Ideally there'd be a socket object as well, who's "state-changed" signal
can be connected to to watch for the end of the connect() call.

-- 
Peace,

    Jim Cape
    http://ignore-your.tv

    "We still name our military helicopter gunships after victims
     of genocide. Nobody bats an eyelash about that: Blackhawk.
     Apache. And Comanche. If the Luftwaffe named its military
     helicopters Jew and Gypsy, I suppose people would notice."
       -- Noam Chomsky, "Propaganda and the Public Mind"

Attachment: signature.asc
Description: This is a digitally signed message part



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