Re: [Vala] Documenting 'async' / WAS: Further speculations on couroutines, generators and threads : Emulating Go's goroutines and channels in Vala

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

- 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.


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:

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 Peters                  (_)/=\~/_(_)                 jim uazu net
                         (_)  /=\  ~/_  (_)
 UazĂș                  (_)    /=\    ~/_    (_)                http://
 in Peru            (_) ____ /=\ ____ ~/_ ____ (_)  

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