Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Sharring variables between multiple threads.

Posted on 2006-06-15
2
Medium Priority
?
303 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 2000 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

Independent Software Vendors: 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

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
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…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

618 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