Hello list,

Basically I want to call an async method that waits for a response from
some object. But, if after, lets say 2 seconds, it don't receive a
response, return an error.

I attached a test case of what i think it can work, but i don't know how
to resume/cancel an async method...

Any help is welcome
Thanks
Matias
interface Foo : GLib.Object
{
	public signal void message_received ();
	
	public void send_message (string message);
}

async void run ()
{
	_foo.send_message ("ping");
	Timeout.add (2000, message_timeout);
	yield;
	//How to check if the async method ended well o wrong?
}

bool message_timeout ()
{
	//How to resume the async method with error?
	return false;
}

Foo _foo;

void main (string[] args)
{
	_foo = create_instance_of_foo ();
	
	_foo.message_received.connect (() => {
		//How to resume the async method without error?
	});
	
	run.begin ();
	
	var loop = new GLib.MainLoop (null, false);
	loop.run ();
}
_______________________________________________
vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to