Created
May 26, 2015 15:38
-
-
Save dhananjaysathe/5920e33dfea8ae0de381 to your computer and use it in GitHub Desktop.
test atomicity of select inside thread
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def test val | |
sleep 0.1 | |
return val%2 | |
end | |
tp = (1..100).to_a | |
Thread.new{z= tp.select{|i| (test i )== 0};puts z} | |
tp=[1,2,3] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment