boost::thread condition variables

(using windows XP, VS2008) Is there a limit to the number that can be constructed/destructed in a single process over time? I have a loop which was doing while (1) { condition_variable cv; mutex mx; // do some things with cv and mx } that while loop would run maybe 200 or 300 times. Occasionally, I'd get a crash in notify_all (), where it seemed like a handle wasn't valid. When I move the declaration of the variables outside the while loop, this doesn't happen. Now, it's entirely possible that I have some other bizarre race condition. In fact, if my previous years of experience have taught me anything, I will discover that error in the very next session after I hit "send" on this email. However..... is there some limit to constructing/destructing and using up Windows handles that I should know about?

On 5/8/2010 7:10 PM, Eric J. Holtman wrote:
Is there a limit to the number that can be constructed/destructed in a single process over time?
.....
Now, it's entirely possible that I have some other bizarre race condition. In fact, if my previous years of experience have taught me anything, I will discover that error in the very next session after I hit "send" on this email.
Sure enough, it was a race. I was destructing the condvar while it was still in the midst of processing notify_all (). Eric <------ idiot. Sorry, all.
participants (1)
-
Eric J. Holtman