Component index
Section index

Component COROUTINE


Search

	/*
	    This shows two nested COROUTINE
	*/
	<mod>
	static void sample_coroutine4()
	{
	    glocal int val;
	    <obj COROUTINE co>();
	    <f run>
	        <obj COROUTINE co>();
	        <f run>
	            for (int i=0; i<5; i++){
	                glocal.val = i;
	                yield();
	            }
	        </f>
	        </obj>
	        while (co.next()){
	            glocal.val += 1000;
	            yield();
	        }
	    </f>
	    </obj>
	    while (co.next()){
	        printf ("result %d\n",glocal.val);
	    }
	    printf ("End\n");
	}
	</mod>