Using GCancellable

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

 



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


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

  Powered by Linux