RE: Something is wrong with my threads

Andy Jones <[email protected]>
Newsgroups gmane.comp.lang.ruby.general
Message-ID <[email protected]>
> You don’t test race conditions by simulating non-deterministic conditions.
> You test a race condition by deterministically faking the race collision.

I rather thought that I was doing the latter.  I'm attempting to arrange for fifty threads to call a method at the same time.

That in itself is not deterministic -- I can't guarantee to be successful in doing that every time, unfortunately, or I could just make two threads instead of fifty.  But I'm not "simulating a non-deterministic condition".  The condition is deterministic; if I manage to call the same method twice at exactly the same time, then there will always be a problem.  (Except the code uses a Mutex, so I'm testing that there is not one.)

I'm really not sure what point you are making here.


> Or you design your code to not have the race condition at all (better).

I have.  I've used a Mutex to eliminate the possibility of a race condition.  Now I need to test that that works.



Click here to view Company Information and Confidentiality Notice.<http://www.jameshall.co.uk/index.php/small-print/email-disclaimer>

Please note that we have updated our privacy policy in line with new data protection regulations. Please refer to our website to view the ways in which we handle your data.

Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.