view tests/mini/fiber.d @ 1161:f528e55fb32f

Force initialize the runtime module in Module::genLLVMModule. It is required for all non-trivial D modules anyway, so why load it lazily? This fixes run/typeid_83.d (DtoDeclareTypeInfo expects runtime to be initialized)
author Christian Kamm <kamm incasoftware de>
date Sat, 28 Mar 2009 20:01:37 +0100
parents 4ac97ec7c18e
children
line wrap: on
line source

private import tango.core.Thread;

extern(C) void printf(char*, ...);

void foo()
{
		printf("-- I am here\n");
		Fiber.yield();
		printf("-- Now I am here\n");
}

void main()
{
	Fiber f = new Fiber(&foo);

	printf("Running f once\n");
	f.call();
	printf("Running f again\n");
	f.call();
}