This project is read-only.

IsBusy always true

Jun 20, 2011 at 10:01 AM


i have an algorithm which needs to be invoked several times. But after invoking once the is busy indicator is always true, hence the algorithm does only run once.

When does the IsBusy flag change to false?






Sep 25, 2011 at 1:06 PM

Hi Apo,
Sorry for the delay. I thought that as an author I will be notified about all activities in this project but I was wrong.
I don’t know If you’ve figured it out yourself by now but here are some details about IsBusy flag:

It doesn’t stay true forever. It is set to true shortly before you start asynchronous operation usually still in the main thread. Then it stays true as long as the function is being executed. Then when it completes the flag is set to false on the background thread and Completed event is posted to be risen in the main thread.

AsyncFunc class implements the most usual and also the simplest scenario of the EAP. If your algorithm requires multiple operation being executed in the background then you can use different primitives like AsyncFuncMultipleInvocation<T, TResult>. It allows you to start an arbitrary number of operations but each of them needs to be identified by unique object (userState). Although this works quite well for operations triggered by the user, if you are looking for a method to parallelize your algorithm you can run into some problems with coordinating operations. That’s because EAP wasn’t designed for that and there are no primitives for coordination build in the framework. Even if I added them to AsyncFunc the performance would suffer because because coordination would have to go through main thread (EAP).

If you think that AsyncFunc fits into your scenario but lacks something, please let me know and I will add it. I’m much more responsive once I know about the issue.