473,395 Members | 1,680 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Asnc Calls and events in .net 1.1

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?

Nov 7 '06 #1
2 1441
"Glenn" <gl**********@bt.comwrote in message
news:11**********************@i42g2000cwa.googlegr oups.com...
[...]
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
Nov 7 '06 #2
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

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Glenn" wrote:
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?

Nov 7 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: wobbles | last post by:
Hi Everyone (Happy New Year!), If I have clients that want to tell the server that something has happened, what would be the difference between "remoting events" and using an asynchronous (one...
2
by: metzger | last post by:
I am using the function listed below to handle characters events in SAX. It does not handle multiple sequential calls to this function correctly. For example, I am getting "2 4 816 32 64" as a...
4
by: =?Utf-8?B?SmFtZXMgR2V1cnRz?= | last post by:
On my page, I have one repeater that contains a literal control and a nested repeater. The nested repeater contains a literal control. Both repeaters are databound with only one object (string). ...
3
by: Bob | last post by:
Hi, I have a newbie question on event listening. I have a form that is monitoring progress in an application. The application consists of many classes, multithreaded, etc. The form listens for...
6
by: Smithers | last post by:
Just looking to compile a list of "all the ways to implement events". I'm NOT looking to get into the merits or mechanics of each in this thread... just want to identify them all - good, bad, and...
5
by: raylopez99 | last post by:
I understand delegates (static and non-static) and I agree they are very useful, and that the "Forms" used in the Windows .NET API could not work without them. That said, I'm curious as to how...
3
by: JohnM | last post by:
Hi there, Are there any specific rules or best-practices I should be aware regarding events and the threads they're fired on. Object 1 can be created on thread 1 for instance and an event then...
7
by: Siegfried Heintze | last post by:
I'm studying the book "Microsoft Visual Basic.NET Language Reference" and I would like some clarify the difference between events and delegates. On page 156 I see a WinForms example of timer that...
5
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hello, I am aware that in ASP.NET there is the concept of event bubbling. What I am after is some advice on achieveing the same thing in a standard application. Say I have 3 classes. View,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.