Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / April 2007

Tip: Looking for answers? Try searching our database.

Callback Delimma...

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
altagrego@gmail.com - 12 Apr 2007 16:35 GMT
Greetings,

1.    Multiple threads will make REQUESTs.  (I synchronous request per
thread)  The number of threads could vary..  (1..n) where n could be
10,000.

2.   A separate thread will be monitoring the central RESPONSE
depository. (queue/list  whatever...)

3.   Each request/response  will have a matching unique ID so that the
monitoring thread can route the response back to the proper thread
that made the request.  So the monitoring thread will simply receive
the response, determine it's destination (request thread), and send it
back...

4.   I don't want 10,000 threads to poll or search for their specific
response !  That would be very inefficient...

5.    My setup is :  (xp, vs2005, framework 2.0, c#)

How is the "best" way to implement STEP 3 in a C# ????
Chris Mullins [MVP] - 12 Apr 2007 17:28 GMT
You've pretty much described IAsyncResult , and the problem that it was
designed to solve.

I would suggest reading some articles people have put together on writing
asynchronous code, and making use of IAsyncResult. This pattern makes use of
a ManualResetEvent, so each of your 10k threads ends up blocking on a
particular event, and the wait is therefore pretty efficient. When the
"worker" thead completes a task, it sets the event inside the AsyncResult,
which causes the originally blocked thread to wake up and being processing.

I would normally send you some links, but there are so many articles on the
web, that you can just hit Google and get more than you'll know what to do
with...

Signature

Chris Mullins, MCSD.NET, MCPD:Enterprise, Microsoft C# MVP
http://www.coversant.com/blogs/cmullins

> Greetings,
>
[quoted text clipped - 17 lines]
>
> How is the "best" way to implement STEP 3 in a C# ????

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.