From Modula-2 Reloaded

Spec: Coroutines

DEFINITION MODULE COROUTINES;

(* Coroutine library *)

FROM SYSTEM IMPORT ADDRESS;

TYPE
    Coroutine = OPAQUE;

    CoroutineProc = PROCEDURE ( ADDRESS );

PROCEDURE New( p : CoroutineProc; stackSize : LONGCARD ) : Coroutine;
  (* Returns a new coroutine with stack size stackSize, associated with procedure p. *)

PROCEDURE Yield( coroutine : Coroutine; sharedData: ADDRESS );
  (* Transfers control to coroutine, passing an address for shared data in sharedData. *)

PROCEDURE Dispose( coroutine : Coroutine ) : Coroutine;
  (* Disposes of coroutine and returns NIL. *)

EDN COROUTINES.
Retrieved from http://modula-2.net/m2r10/pmwiki.php?n=Spec.Coroutines
Page last modified on 2010-01-14 20:00