> OK, sorry for being such a wrong-wronger! :-) lol, no worries.
> Lock( ) the CS again, it's put to sleep like thread2 was. After thread2 > finishes up and calls Unlock( ) again, the 'lock' flag is cleared and the > resource is free to be accessed from the same (or other) thread(s). That's excellent, thankyou. Now understood how it's supposed to work. > > Now, it's clear why you should use prosen's suggestion, because it ensures > that the Unlock( ) is called no matter what happens (e.g an exception is > thrown.) Just imagine that a thread holding a lock faces an > exception, and > execution gets resumed from some point upper in the call stack. Now, no > other threads can access the resource until the app is terminated. That's > not what is desirable to you, of course. Good point, well made. I will have a little think about the code involved and I might change to incorporate that thinking. This is only a private project, but that doesn't mean it's any less important. -- Jason Teagle [EMAIL PROTECTED]
