I have a vb.net application that uses threads to asynchronously process some tasks in a "Scheduled Task" (console application).
We are limiting this app to run 10 threads at once, like so:
(pseudo-code) - create a generic list of 10 threads - spawn off the threadproc for each one - do a thread.join statement for each thread to wait for the longest running one to complete.
What i am finding is that if the code called by the threadproc contains any "Debug.Writeline" or "Trace.Traceinformation" statements, the thread hangs. I can see the thread in the Debug - Windows - Threads window, and switch to it, but it highlights the debug.writeline statement and never gets past it.
So my question is, is there something special about the Debug or Trace statements that make them non-thread-safe? Any idea why this would hang things up? If I leave the debug statement in, the thread never completes. If I take the debug statement out, the thread completes in less than 5 seconds.
Thanks in advance :)