Re: [Vala] Documenting 'async' / WAS: Further speculations on couroutines, generators and threads : Emulating Go's goroutines and channels in Vala
- From: Serge Hulne <serge hulne gmail com>
- To: Jim Peters <jim uazu net>
- Cc: vala-list <vala-list gnome org>, Alexandre Rosenfeld <alexandre rosenfeld gmail com>
- Subject: Re: [Vala] Documenting 'async' / WAS: Further speculations on couroutines, generators and threads : Emulating Go's goroutines and channels in Vala
- Date: Sat, 16 Jul 2011 06:26:21 +0200
Congratulations to Jim Peters on his excellent job about documenting async
methods in Vala !
Thank you very much !
Question about combining async and threads in the "generator example":
- Would it be possible to combine the last two examples for the following
purpose:
- In the last example, the generator calls the feed() method, gets the next
result (one single result or "item") from feed() then feed() stops, the
generator resumes, returns (the value of the last item), then the generator
pauses, feed() resumes and so on, in a loop.
- Would it not be possible alternatively, for the generator, to call
(slightly more indirectly) the feed() function in an independent thread,
accumulate the last N results in a queue (N being a parameter to pass to the
generator), so that the generator would still appear to return one result at
time, in order, but in fact they would be pulled from the queue, while the
feed function keeps running in the background feeding the queue (the queue
would act as a buffer, storing the last N results of the feed() method).
- The expected result is an expected increase of performance, compared to
the present scheme where feed() and the generator wait in turn for each
other, exchanging only one item at a time.
Serge.
Would it not be possible to combine the last two examples:
On Fri, Jul 15, 2011 at 11:43 PM, Jim Peters <jim uazu net> wrote:
I've created a new page on the wiki trying to make the 'async' stuff
easier to understand:
http://live.gnome.org/Vala/AsyncMethods
I've added the old GIO example (updated to shutdown nicely), a
Generator example, and an example that starts a background thread.
I'm not sure what the procedure is for documentation, or who owns
what. This page could be merged with the Tutorial if someone thinks
that is a good idea.
If there is anything incorrect, I'm happy to fix it --
Jim
--
Jim Peters (_)/=\~/_(_) jim uazu net
(_) /=\ ~/_ (_)
UazĂș (_) /=\ ~/_ (_) http://
in Peru (_) ____ /=\ ____ ~/_ ____ (_) uazu.net
- References:
- [Vala] Further speculations on couroutines, generators and threads : Emulating Go's goroutines and channels in Vala
- Re: [Vala] Further speculations on couroutines, generators and threads : Emulating Go's goroutines and channels in Vala
- Re: [Vala] Further speculations on couroutines, generators and threads : Emulating Go's goroutines and channels in Vala
- Re: [Vala] Further speculations on couroutines, generators and threads : Emulating Go's goroutines and channels in Vala
- Re: [Vala] Further speculations on couroutines, generators and threads : Emulating Go's goroutines and channels in Vala
- From: Alexandre Rosenfeld
- [Vala] Documenting 'async' / WAS: Further speculations on couroutines, generators and threads : Emulating Go's goroutines and channels in Vala
- Re: [Vala] Documenting 'async' / WAS: Further speculations on couroutines, generators and threads : Emulating Go's goroutines and channels in Vala
- Re: [Vala] Documenting 'async' / WAS: Further speculations on couroutines, generators and threads : Emulating Go's goroutines and channels in Vala
- Re: [Vala] Documenting 'async' / WAS: Further speculations on couroutines, generators and threads : Emulating Go's goroutines and channels in Vala
- Re: [Vala] Documenting 'async' / WAS: Further speculations on couroutines, generators and threads : Emulating Go's goroutines and channels in Vala
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]