All pastes #1570130 Raw Edit

Etwas

public text v1 · immutable
#1570130 ·published 2009-09-17 21:18 UTC
rendered paste body
using GLib;
MainLoop loop;

errordomain Problem
{
	ERROR,
}

async void innerAsync() throws Problem
{
	var x = 5;
	Idle.add( innerAsync.callback );
	yield;
	if ( x == 5 )
	{
		throw new Problem.ERROR( "problem" );
	}
}

async void runAsync() throws Problem
{
	message( "1" );
	Idle.add( runAsync.callback );
	yield;
	try
	{
		yield innerAsync();
	}
	catch ( Problem p )
	{
		message( "problem: %s", p.message );
	}
}

void main()
{
	loop = new MainLoop( null, false );
	runAsync();
	loop.run();
}