Thanks for reply. With your tips I was able to find out how it is
working!
Also the old code does compile fine.
I updated my asyn stream reading example on the vala homepage and I
added a new version with the async syntax:
http://live.gnome.org/action/logout/Vala/GIOSamples?action=logout&logout=logout#head-4a7d5b20ddcbd5b458b2bae2c698df6fb6f005f5
Regards
Jörn

Am Montag, den 14.09.2009, 20:21 +0200 schrieb Jan Hudec: 
> On Mon, Sep 14, 2009 at 19:59:09 +0200, lariamat wrote:
> > Hi all
> > I wonder how the latest changes to the gio vapi have to be used in a
> > program. I have no experience with the other async stuff. How can I
> > connect that to a callback that would handle the GLib.AsyncResult like
> > in
> > http://live.gnome.org/Vala/GIOSamples#head-164983820b65aa689b970b193fec6ddc7368179e
> > ? 
> > 
> > Excerpt from the patch: 
> > - public void read_line_async (int io_priority, GLib.Cancellable?
> > cancellable, GLib.AsyncReadyCallback callback);
> > - public unowned string read_line_finish (GLib.AsyncResult _result, out
> > size_t length) throws GLib.Error;
> > + public async unowned string read_line_async (int io_priority,
> > GLib.Cancellable? cancellable, out size_t length) throws GLib.Error;
> > + public unowned string read_line_finish (GLib.AsyncResult _result, out
> > unowned size_t length) throws GLib.Error;
> 
> The old code should still compile, or at least that's what I understood from
> yesterday's discussion on IRC.
> 
> In addition to that, new syntax for methods, that suspend themselves until an
> async result is ready was added by that change. It should work roughly like:
> 
>  - declare the method with async modifier.
>  - inside the method, you can either
>      result = yield another-async-method(params);
>    or
>      set_callback_on_something(methodname.callback);
>      yield;
>      obtain_the_result();
>    Have a look at the test case in tests/dbus/async.test in the source tree
> 
> (that's a DBus stuff, but the syntax is general for anything using
> GLib.AsyncResult)
> 

_______________________________________________
Vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to