> Aha! I have got it working, thanks to reading your sample and trying > to see what the differences are.
No, you haven't got anything working! :-) BTW, you have considered prosen's suggestion for creating a scope guard, haven't you? It's a bright suggestion. > I /think/ my problem was that the CCriticalSection needs to be > constructed from within the thread that wants to protect the resource. > By constructing one within the worker thread routine itself and > locking it, and also constructing a different one (both on the stack) > in the routine adding items to the queue, it suddenly works! But you're not protecting anything. And your assumptions above are incorrect. The whole thing that makes a sync object exist is that it can safely be accessed from multiple thread simultaneously. > I can understand this logic a little, since the whole point is that > the critical section is protecting the thread from interruption, so of > course it must be created in the thread that needs protecting. No, like I said, this is wrong. ------------- Ehsan Akhgari Farda Technology (http://www.farda-tech.com/) List Owner: [EMAIL PROTECTED] [ Email: [EMAIL PROTECTED] ] [ WWW: http://www.beginthread.com/Ehsan ] With one's principles one seeks to tyrannize over one's habits or to justify or honour or scold or conceal them - two people with the same principles probably seek something fundamentally different with them. -Beyond Good And Evil, F. W. Nietzsche
