in reply to Redirecting output in Windows cmd prevents second thread from doing anything
You are misinterpreting what you are seeing. (As is everyone else who has replied.)
The "problem" is simply that given the size of your data, thread 1 has completed processing the entire array before thread 2 gets a chance to do anything.
You can prove this by increasing the volume of element in the array -- around 4000 should suffice, I simply duplicated the 1..200 20 times -- then you'll see that whilst the first couple of thousand are all processed by thread 1; after that, thread 2 gets a look-in and they start alternating.
You'll probably also notice that the logging starts getting mixed together -- partial lines from one thread being tacked onto the end of partial lines from the other -- but that's a different problem.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Redirecting output in Windows cmd prevents second thread from doing anything
by 1nickt (Canon) on Jan 15, 2016 at 22:29 UTC | |
by BrowserUk (Patriarch) on Jan 16, 2016 at 02:06 UTC | |
by SimonPratt (Friar) on Jan 16, 2016 at 08:40 UTC |