File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -29,15 +29,15 @@ def self.spawn(&block)
29
29
end
30
30
31
31
def self . storage
32
- if backend == :fiber || backend == :poylphony
32
+ if fiber_backed?
33
33
Fiber . current . storage
34
34
else
35
35
Thread . current
36
36
end
37
37
end
38
38
39
39
def self . current
40
- if backend == :fiber || backend == :poylphony
40
+ if fiber_backed?
41
41
Fiber . current
42
42
else
43
43
Thread . current
@@ -64,15 +64,15 @@ def self.switch
64
64
# they must send (true) as a parameter to this method
65
65
# else it is a no-op for fibers
66
66
def self . synchronize ( fiber_sync = false , &block )
67
- if ( backend == :fiber ) || ( backend == :polyphony )
67
+ if fiber_backed?
68
68
yield # do nothing, just run the block as is
69
69
else
70
70
mutex . synchronize ( &block )
71
71
end
72
72
end
73
73
74
74
def self . max_contexts
75
- return 50 if backend == :fiber || backend == :polyphony
75
+ return 50 if fiber_backed?
76
76
5
77
77
end
78
78
@@ -81,4 +81,10 @@ def self.mutex
81
81
# a single mutex per process (is that ok?)
82
82
@@mutex ||= Mutex . new
83
83
end
84
+
85
+ private
86
+
87
+ def self . fiber_backed?
88
+ backend == :fiber || backend == :polyphony
89
+ end
84
90
end
You can’t perform that action at this time.
0 commit comments