From: Caleb Clausen Date: 2010-05-06T02:24:31+09:00 Subject: [ruby-core:30028] Re: [Bug #2488] thread usage can result in bad HANDLE On 5/1/10, _ wanabe wrote: > Issue #2488 has been updated by _ wanabe. > > File lock_before_reset.patch added I have to admit that I've been wondering something about this patch for days, but I haven't had the nerve to speak up, since I don't understand win32 programming that well... Why is it necessary to re-check that intr is set to what it was set to just two lines before? I assume it might be changed by the action of another thread, but if that's the case, wouldn't it be better to just check that field once while inside the global_vm_lock? (ie move the lock/unlock to be around the whole if statement.) For that matter, shouldn't ruby be using the api provided by windows (WaitForSingleObject, apparently) to check the state of this 'event object' (really a semaphore)? If you do it that way, then maybe the global_vm_lock doesn't need to be touched.