Hi, I haven't studied that in any detail, I do have a few comments though: 1. you have a Monitor.Exit inside a for loop, whereas the Monitor.Enter is executed only once? That means most of the loop is not protected by the monitor. 2. Thread.Sleep() takes an integer parameter representing the requested delay in milliseconds. However, its resolution is really system-dependent, and never that good. It typically will round up to a multiple of some 15 milliseconds. If you want details, I suggest you read Timer surprises, and how to avoid them[^]. 3. Rather than constructing a poll loop to wait for the end of one or more threads, I suggest you read up on Thread.Join() :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).