Asnc Calls and events in .net 1.1

  • Thread starter Thread starter Glenn
  • Start date Start date
G

Glenn

I have a class which has an async function which uses begininvoke on a
delegate to run a private function in the class. The class has an
event which reports back i) a unique identifier for that instance and
2) the progress of the operation

on my form class I create a new background thread and I declare two
instances of the class.

I create an event handler and connect this up to the progress changed
event of both classes. The handler reports progress to the UI thread to
a certain control based upon the Unique ID in the event.

when i run this; class1's events are fired up until the function
completes then class2's events are fired , rather then the classes both
running and raises events at the same time.

can anyone see something i am doing wrong, or a concept I has
mis-understood?
 
Glenn said:
[...]
can anyone see something i am doing wrong, or a concept I has
mis-understood?

Perhaps if you posted some code, it would be more likely for someone to see
what you're doing wrong.

Obviously you've serialized your processing somehow. But how you've done
that can only be guessed at, unless you post your code.

That said, you say that you only create one new background thread, so
depending on how your classes actually handle the asynchronous processing,
it's not clear that you've done anything that would allow for simultaneous
processing of the two tasks.

Pete
 
You probably would want to either Queue these into the ThreadPool as
WorkItems and do a WaitAll, or use one of the overloads of the AsyncResult
object in your callbacks to do something similar. What I think you are saying
is that you need to not return until both calls are complete and both events
fired.
Look up the WaitOne, WaitAny and WaitAll objects in MSDN for some sample code.
Peter
 
Back
Top