Re: [Vala] Bug in async methods?

2012-10-23 Thread Luca Bruno
This is an example of async methods working without a mainloop: http://valajournal.blogspot.it/2011/07/generators-in-vala.html As long as you invoke the callback manually, there's no need of a mainloop. -- www.debian.org - The Universal Operating System

Re: [Vala] Bug in async methods?

2012-10-22 Thread Jim Nelson
For async to work properly, you must run the GLib MainLoop.  MainLoop is where your async closure for test_function.begin() is called.  It's where all callbacks are scheduled, actually. The only reason this works is that in the case of DO_YIELD you stash the test_function.callback and then

Re: [Vala] Bug in async methods?

2012-10-22 Thread rastersoft
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Yes, you are right: I created a main loop, called run(), and the callback got called. Anyway, I don't understand why is not possible to ensure that the end callback gets called even without a main loop :? Thanks! El 23/10/12 00:03, Jim Nelson

Re: [Vala] Bug in async methods?

2012-10-22 Thread Jim Nelson
It would take me a bit of time to explain async (I've thought about blogging about it), but the short answer is: Vala's async and yield keywords are designed to use MainLoop to schedule code execution. You don't *have* to use them to do asynchronous work, but they are certainly convenient. --

Re: [Vala] Bug in async methods?

2012-10-22 Thread rastersoft
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 If you have some spare time, please, blog it. Thanks! El 23/10/12 00:22, Jim Nelson escribió: It would take me a bit of time to explain async (I've thought about blogging about it), but the short answer is: Vala's async and yield keywords are

Re: [Vala] Bug in async methods?

2012-10-22 Thread rastersoft
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I've been watching the source code generated by Vala and the key is here: _data_-result = 1; if (_data_-_state_ == 0) { g_simple_async_result_complete_in_idle (_data_-_async_result); } else {

Re: [Vala] Bug in async methods?

2012-10-22 Thread Jim Nelson
I think you would need to work with the Vala team to get something like this landed.  Part of the solution might be to look at the other back-ends that Vala supports (i.e. Posix), although I think those are kept in a separate branch and not supported in the main distribution. However, I