title: How can I share resources with threads in C#?
body: <p>I have a thread reading from a specific plc's memory and it works perfectly. Now what I want is to start another thread to test the behavior of the system (simulate the first thread) in case of a conectivity issue, and when everything is Ok, continue the first thread. But I think I'll have problems with that because these two threads will need to use the same port. </p>
  
  <p>My first idea was to abort the first thread, start the second one and when the everything's OK again, abort this thread and 'restart' the first one.</p>
  
  <p>I've read some other forums and people say that aborting or suspending a thread is the worst solution, and I've read about syncronization of threads but I dont really know if this is useful in this case because I've never used it.</p>
  
  <p>My question is, what is the correct way to solve this kind of situations?</p>