03-19-2014, 03:45 PM
At the beginning insert
lock
Then next thread will wait until previous thread leaves the locked code. Will be sequential execution instead of parallel.
But the number of threads is limited to 500 or 1000, don't remember. If will be many waiting threads, will need a queue, more work.
lock
Then next thread will wait until previous thread leaves the locked code. Will be sequential execution instead of parallel.
But the number of threads is limited to 500 or 1000, don't remember. If will be many waiting threads, will need a queue, more work.