Re: [Vala] Question about a basic coroutine example



On Thu, Jul 07, 2011 at 09:35:41PM +0200, Serge Hulne wrote:
In the snippet hereunder, I  expected the respective value of the argument
of the sleep() method, in the methods foo0() and foo1(), to have an
influence on which one of said coroutines completes first.

Apparently it is not the case, so I am assuming that foo0 and foo1 run, in
fact, sequentially (and not asynchronously as would, say two children
processes, for instance).

Is there a way to modify the snippet hereunder so that the coroutine which
executes faster completes first (or like two children processes) ?

Coroutines work cooperatively, not preemtively. You should use threads.

-- 
http://www.debian.org - The Universal Operating System



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