Re: [Vala] Questions on async functions



Nor Jaidi Tuah píše v Čt 04. 02. 2010 v 07:59 +0800:
What is the recommended way of aborting an
async function so that another invocation can
be made only after the previous one has
stopped, thus ensuring that there is at most
one invocation at any time?


I think I don't fully understand the question here. You can simply add
the invocations into another async method, thus chaining them one after
another. Isn't that what you mean?

What I really meant is something like this.

First call an async function:

  async_func (xx);

after a while something happens in the main
line (not in the async function) that requires this:

   signal and wait for the invocation async_func (xx) to stop
   async_func (yy);

So, what's the recommended way to "signal and wait for
the invocation async_func (xx) to stop" so that asyn_func (yy)
can proceed afresh?

hand
Nor Jaidi Tuah



For terminating the previous one a Cancellable parameter is the best
way. As for the chaining, I suppose you could do some magic in the
method itself. For example having a bool indicator and postponing the
execution until it's false (in case you want it to always behave this
way).


Attachment: signature.asc
Description: Toto je digitálně podepsaná část zprávy



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]