[Mono-devel-list] Coroutines

Joe Ante joe at otee.dk
Mon Sep 20 08:58:23 EDT 2004


I am using embedded mono as a scripting language runtime in our game engine
and I would like to use coroutines to simplify some of our game code.

I want to be able to write scripts like this:

void Update ()
    Console.WriteLine ("Starting up");
    //Yields for 20 seconds, then continues
    WaitFor (20.F);
    Console.WriteLine ("20 seconds later");

The WaitFor function would yield back to unmanaged code.
The unmanaged code would then simply go on, possibly calling other C#
methods in the same class/instance.
After 20 seconds, the engine would resume the Update method.

- I am looking for the simplest to implement solution. It does not have to
be very fast, at least for now.

- If it is possible i would like to modify as little mcs code as possible
since we are going to support javascript and python later on and i would
like to be able to just put in support for other languages without having to
make the compiler support special yield functionality.

Where do i start?
Any idea's on how to implement this?
Is anyone else working on it?

Joachim Ante

More information about the Mono-devel-list mailing list