Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

explicitly test the thread safety of Hitimes::Stats.

  • Loading branch information...
commit f7cdcdfd6aed9e676b0292abfab4da5bada3e35d 1 parent 139a4e4
@copiousfreetime authored
Showing with 7 additions and 2 deletions.
  1. +7 −2 spec/mutex_stats_spec.rb
View
9 spec/mutex_stats_spec.rb
@@ -16,8 +16,13 @@ def run_with_scissors( stats, threads, iters )
return stats
end
- it "is unsafe normally" do
- pending "not for MRI -- not interruptable in this C extension" do
+ if (not defined? RUBY_ENGINE) or (RUBY_ENGINE == "ruby") then
+ it "Hitimes::Stats is threadsafe" do
+ stats = run_with_scissors( ::Hitimes::Stats.new, @threads, @iters )
+ stats.count.should== @final_value
+ end
+ else
+ it "Hitimes::Stats is not threadsafe" do
stats = run_with_scissors( ::Hitimes::Stats.new, @threads, @iters )
stats.count.should_not == @final_value
end
Please sign in to comment.
Something went wrong with that request. Please try again.