On Sat, 13 Mar 2010, dherring@... wrote:
>> I have code I know is not thread-safe, but it's nearly impossible to
>> write test cases that exhibit a bug reliably (or even just with a
>> certain percentage) because the window of interruption to trigger the
>> bug is just one, or two instructions.
>> If I insert an explicit (thread-yield) at the right place, a test case
>> is very easy to write.
>> Now I wonder how easy/difficult it would be to make the compiler insert
>> calls to (thread-yield) randomly. Inserting on instruction granularity
>> sounds difficult to do if the compiler architecture wasn't made for it
>> -- especially because SBCL does not have a peephole optimizer --, but
>> perhaps between vops? (That's also where an manual insertion of
>> (thread-yield) could go, so..)
>> If a feature like that was available, I hope that making my test suite
>> recompile the system again and again (to trigger different placement of
>> the calls to (thread-yield), and running the test suite again and again,
>> would result in exhibiting such bugs in say one out of 100, or 1000
>> Does anyone happen to know of prior art?
> This is driving me batty; a few months ago I found a similar toolkit for
> C++, but the link is at work. Can't seem to find it.
What's a month?
Here's the project: Relacy Race Detector