class AsyncDelegate {
	delegate void TestFunc ();

	void test_func () {
		print ("delegate\n");
	}

	async void test_async (TestFunc f) {
		print ("async enter\n");
		Idle.add (test_async.callback);
		yield;
		f ();
		print ("async leave\n");
	}

	static int main (string[] args) {
		var loop = new GLib.MainLoop (null, false);
		var app = new AsyncDelegate ();

		app.test_async.begin (app.test_func);
		print ("loop\n");
		loop.run ();

		return 0;
	}
}
