Re: Using GCancellable

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

 



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@xxxxxxxxx
> > > http://mail.gnome.org/mailman/listinfo/gtk-list
> 
> _______________________________________________
> gtk-list mailing list
> gtk-list@xxxxxxxxx
> http://mail.gnome.org/mailman/listinfo/gtk-list

_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list



[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux