Re: [Vala] [Announcement] Vala will use GTask for async code instead of GSimpleAsyncResult if --target-glib=2.36 or greater is selected
> - Original Message - > From: Michele Dionisio > Sent: Tuesday, 22 November 2016, 0:32 > Subject: Re: [Vala] [Announcement] Vala will use GTask for async code instead > of GSimpleAsyncResult if --target-glib=2.36 or greater is selected > few weeks ago I post bug: > https://bugzilla.gnome.org/show_bug.cgi?id=772084 > With patch attached to solve a bug raised calling an sync function > that is not really asyncronous (with vala only is not possible to > create async code that is not asyncronous, but if vala call C code, >like gio, everything can happens) > somone think that is it convinent that I update my patch for the new code? The code generator switch, --target-glib, defaults to 2.32 for current Vala. When this default is changed to 2.36 or above then the old GSimpleAsyncResult will be removed. So, yes, all new patches targeting Vala's async code generation should use the GTask paths. Vala annotates a function with .begin, .callback and .end when the function is marked as async. This can be used to create coroutines ( https://en.wikipedia.org/wiki/Coroutine ). The main example of this in Vala has been for a generator. The generator example is now a test case in Vala: https://git.gnome.org/browse/vala/commit/?id=6e89b7b5d8112925cb8f07234a85ea1dba1e32e6 The question is whether Vala should fully support such a use case. The mailing list thread you point to has the original poster concluding "I think such warning that code must be async in 100% cases should be explicitly added to the documentation." ( https://mail.gnome.org/archives/vala-list/2016-March/msg00024.html ). The discussion in the bugzilla report for the GTask patch has some relevant discussion ( https://mail.gnome.org/archives/vala-list/2016-March/msg00024.html ). You should look at comments #13, #18, #19 and the patch to get the generator example working (comment #20). I guess there are three possible solutions: 1. Treat it as a documentation bug and make it clear async code requires a GMainContext and to be used asynchronously to work reliably in all cases 2. Add warning / error to Vala (probably the flow analyzer) that code is not being used asychronously 3. Work on making Vala work robustly when co-routines are used, there are examples of attempts to use co-routines with GLib, see https://patchwork.ozlabs.org/patch/427187/ I hope this provides some context to frame the ideas behind your patch, but I personally don't have the depth of knowledge or understanding to thoroughly review your patch. Thanks for you work on Vala, Al ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] [Announcement] Vala will use GTask for async code instead of GSimpleAsyncResult if --target-glib=2.36 or greater is selected
> 1. Treat it as a documentation bug and make it clear async code > requires a GMainContext and to be used asynchronously to work > reliably in all cases > Totally confused here. I checked gtask.c and apparently it is designed to handle synchronous task too. * SECTION:gtask * @short_description: Cancellable synchronous or asynchronous task * and result Here I'm not objecting to option 1. After all, using async for sync is dubious. I'm just confused why gtask cannot be used for sync task when its own description specifically indicates that possibility. Nice day Nor Jaidi Tuah PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you are neither the addressee (intended recipient) nor an authorised recipient of the addressee, and have received this message in error, please destroy this message (including attachments) and notify the sender immediately. STRICT PROHIBITION: This message, whether in part or in whole, should not be reviewed, retained, copied, reused, disclosed, distributed or used for any purpose whatsoever. Such unauthorised use may be unlawful and may contain material protected by the Official Secrets Act (Cap 153) of the Laws of Brunei Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, accept[s] no responsibility for loss or damage arising from the use of this message in any manner whatsoever. Our messages are checked for viruses but we do not accept liability for any viruses which may be transmitted in or with this message. ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] [Announcement] Vala will use GTask for async code instead of GSimpleAsyncResult if --target-glib=2.36 or greater is selected
The problem is not gtask but how vala generate the c code to manage yield. In this moment yield need that the control go back to the mainloop almost one time. Il mer nov 23 02:41:14 2016 GMT+0100, Nor Jaidi Tuah scrive: > > > 1. Treat it as a documentation bug and make it clear async code > > requires a GMainContext and to be used asynchronously to work > > reliably in all cases > > > > Totally confused here. I checked gtask.c and apparently > it is designed to handle synchronous task too. > > * SECTION:gtask > * @short_description: Cancellable synchronous or asynchronous task > * and result > > Here I'm not objecting to option 1. After all, using async > for sync is dubious. I'm just confused why gtask cannot be > used for sync task when its own description specifically > indicates that possibility. > > Nice day > Nor Jaidi Tuah > > > > > PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you > are neither the addressee (intended recipient) nor an authorised recipient of > the addressee, and have received this message in error, please destroy this > message (including attachments) and notify the sender immediately. STRICT > PROHIBITION: This message, whether in part or in whole, should not be > reviewed, retained, copied, reused, disclosed, distributed or used for any > purpose whatsoever. Such unauthorised use may be unlawful and may contain > material protected by the Official Secrets Act (Cap 153) of the Laws of > Brunei Darussalam. DISCLAIMER: We/This Department/The Government of Brunei > Darussalam, accept[s] no responsibility for loss or damage arising from the > use of this message in any manner whatsoever. Our messages are checked for > viruses but we do not accept liability for any viruses which may be > transmitted in or with this message. > ___ > vala-list mailing list > vala-list@gnome.org > https://mail.gnome.org/mailman/listinfo/vala-list > ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list