Re: Using GCancellable
- From: "Andrew E. Makeev" <andrew solvo ru>
- To: Iñigo Martínez <martinez i ikusi com>
- Cc: gtk-list <gtk-list gnome org>
- Subject: Re: Using GCancellable
- Date: Wed, 26 May 2010 12:57:06 +0400
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
--
Andrew E. Makeev <andrew solvo ru>
Solvo Logistic
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]