Solved

Sharring variables between multiple threads.

Posted on 2006-06-15
2
267 Views
Last Modified: 2010-04-16
Hi Experts,

      I need to know the right way of sharing data between different threads.  I have a main thread which is going to spawn about 10 different instances of the same worker thread.  These worker threads are going to collect information and put them each into a seperate instance (or array member) of the same structure.  So I would like to end up with an array of the structure (myStructure[10]) whose members were populated by ten different threads simultaniously.  What's the excepted way of doing something like this?

Thanks,
axnst2
0
Comment
Question by:axnst2
2 Comments
 
LVL 12

Accepted Solution

by:
gbzhhu earned 500 total points
ID: 16911256
Basically, there is no magic on this other than ensuring only 1 thrwead is accessing your structure at any given 1 time.  There are a few ways of doing this using thread synchronization keywords amd classes.  The following article explains better, read all 4 pages

http://www.ondotnet.com/pub/a/dotnet/2001/08/06/csharp.html?page=1
0
 

Author Comment

by:axnst2
ID: 16911477
Thanks!  That'll be useful!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Events in static methods 3 50
Different Delete Messages 7 37
Host asp.net pages 5 25
Error in JQuery 5 39
In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now