Solved

Sharring variables between multiple threads.

Posted on 2006-06-15
2
293 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

726 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