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) ?

Serge.

////////////
using Posix;

MainLoop ml;

async void foo1 () {
    Idle.add(foo1.callback);
    yield;
    for (int i=0; i<10; i++ )  message ("Foo 1");
    Posix.sleep(2);
    ml.quit();
}

async void foo2 () {
    Idle.add(foo2.callback);
    yield;
    for (int i=0; i<10; i++ )  message ("Foo 2");
    Posix.sleep(1);
    ml.quit();
}

void main () {
    foo1.begin();
    foo2.begin();
    ml = new MainLoop();
    ml.run();
}
/////////////
_______________________________________________
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to