Skip to content

Commit d5d0c06

Browse files
committed
Updated benchmark scripts to check for C extensions.
1 parent 0aa9b01 commit d5d0c06

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

examples/bench_atomic.rb

100644100755
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
1+
#!/usr/bin/env ruby
2+
3+
$: << File.expand_path('../../lib', __FILE__)
4+
15
require 'benchmark'
26
require 'rbconfig'
37
require 'thread'
8+
49
require 'concurrent/atomic'
510

11+
unless defined? Concurrent::CAtomic
12+
warn "[ERROR] C extensions not loaded!"
13+
exit(1)
14+
end
15+
616
Thread.abort_on_exception = true
717

818
$go = false # for synchronizing parallel threads

examples/bench_atomic_1.rb

100644100755
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
require 'thread'
77
require 'benchmark'
88

9-
begin
10-
require 'concurrent-ext'
11-
rescue LoadError
12-
require 'concurrent'
9+
require 'concurrent/atomic'
10+
11+
unless defined? Concurrent::CAtomic
12+
warn "[ERROR] C extensions not loaded!"
13+
exit(1)
1314
end
1415

1516
Thread.abort_on_exception = true

0 commit comments

Comments
 (0)