[prev in list] [next in list] [prev in thread] [next in thread]
List: gtk
Subject: Re: Using GCancellable
From: Iñigo_Martínez <martinez.i () ikusi ! com>
Date: 2010-05-28 10:28:12
Message-ID: 1275042493.2873.3.camel () nbiku1124 ! ikusi ! net
[Download RAW message or body]
One important point is that I'm reading from a node created by a device.
I'm not sure if in this case I should use another functions like for
example the ones from GUnixInputStream.
What are the differences between GFileInputStream, GMemoryInputStream
and GUnixInputStream ?
Thank you,
On Wed, 2010-05-26 at 11:08 +0200, Iñigo MartÃnez wrote:
> Thank you for your answer Andrew,
>
> I have tried using smaller buffer size, but without any success. It
> still waits until the read has completed.
>
> Regards,
>
> On Wed, 2010-05-26 at 12:57 +0400, Andrew E. Makeev wrote:
> > I guess, you can't cancel stream reading until BUFSIZ bytes received or
> > end of data.
> >
> > So, the only way to stop reading "ASAP" is smaller BUFSIZ.
> >
> > Ð’ Срд, 26/05/2010 в 10:24 +0200, Iñigo MartÃnez пишет:
> > > Hello:
> > >
> > > I'm using a GCancellable to be able to cancel a reading process, but
> > > it's behaviour is not the one I was expecting. I have this code:
> > >
> > > cancellable = g_cancellable_new ();
> > > file = g_file_new_for_path (path);
> > > input_stream = g_file_read (file, cancellable, &error);
> > >
> > > g_input_stream_read (G_INPUT_STREAM (input_stream),
> > > buffer,
> > > BUFSIZ,
> > > cancellable, &error);
> > >
> > > g_object_unref (input_stream);
> > > g_object_unref (file);
> > > g_object_unref (cancellable);
> > >
> > > And in another thread the cancelling call:
> > >
> > > g_cancellable_cancel (cancellable);
> > >
> > > The behaviour I was expecting was that the blocking call
> > > g_input_stream_read would be unblocked and would return after calling to
> > > g_cancellable_cancel.
> > >
> > > Actually it waits for g_input_stream_read to finish, so it doesn't
> > > really cancel, but g_cancellable is marked as cancelled after that.
> > >
> > > Is this it's normal behaviour ?
> > > If it is, what can I do to cancel a reading process ?
> > >
> > > Thank you,
> > > _______________________________________________
> > > gtk-list mailing list
> > > gtk-list@gnome.org
> > > http://mail.gnome.org/mailman/listinfo/gtk-list
>
> _______________________________________________
> gtk-list mailing list
> gtk-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-list
_______________________________________________
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic