Re: [Vala] Combining async methods with external processes

2010-11-22 Thread James Moschou
On 22 November 2010 05:44, Abderrahim Kitouni wrote: > Hi, >                   في ح، 21-11-2010 عند 16:03 +1030 ، كتب James Moschou: >> Here's an incredibly pared back version of what I have: >> >> >> class Task : Object { >>     Pid _pid; >>     Source _source; >>     public async void run_async

Re: [Vala] Combining async methods with external processes

2010-11-22 Thread Abderrahim Kitouni
Hi, في ح، 21-11-2010 عند 16:03 +1030 ، كتب James Moschou: > Here's an incredibly pared back version of what I have: > > > class Task : Object { > Pid _pid; > Source _source; > public async void run_async () { > try { > Process.spawn_async_with_pi

Re: [Vala] Combining async methods with external processes

2010-11-21 Thread James Moschou
On 20 November 2010 20:59, James Moschou wrote: >> You can attach the .callback to any event source in the same way. So e.g. >> when data arrive from the process or the child terminates etc. > >> But it's easy to wrap it in one. Just spawn_async_with_pipes and arrange the >> .callback to be called

Re: [Vala] Combining async methods with external processes

2010-11-20 Thread James Moschou
> You can attach the .callback to any event source in the same way. So e.g. > when data arrive from the process or the child terminates etc. > But it's easy to wrap it in one. Just spawn_async_with_pipes and arrange the > .callback to be called when results are available and yield. I think I got

Re: [Vala] Combining async methods with external processes

2010-11-19 Thread Jan Hudec
On Fri, Nov 19, 2010 at 13:25:11 +0100, pancake wrote: > you are using coroutines which are not designed to "run stuff in > background". > > coroutines are designed to run collaborative code which hangs if one of the > parts doesn't pass the token when necessary. > > You have to use threads, or a

Re: [Vala] Combining async methods with external processes

2010-11-19 Thread James Moschou
I just thought the async/yield methodology was an elegant way of chaining together multiple background tasks, but are you saying that it's not suited to what I want and I should do it all with threads and hand-written callbacks? On 19 November 2010 22:55, pancake wrote: > you are using coroutines

Re: [Vala] Combining async methods with external processes

2010-11-19 Thread pancake
you are using coroutines which are not designed to "run stuff in background". coroutines are designed to run collaborative code which hangs if one of the parts doesn't pass the token when necessary. You have to use threads, or an idle task if you have a mainloop. On 11/19/10 08:34, James Mosch

[Vala] Combining async methods with external processes

2010-11-18 Thread James Moschou
Hello, I want to perform a series of tasks one after the other, but in the background. So I have: async bool perform_tasks () { bool result = yield task1 (); if (result) result = yield task2 (); if (result) result = yield task3 (); Idle.add (perform_tasks.callback