Module: Actuator
- Defined in:
- lib/actuator.rb,
lib/actuator/job.rb,
lib/actuator/mutex.rb,
lib/actuator/fiber_pool.rb,
ext/actuator/reactor.cpp
Defined Under Namespace
Classes: ConditionVariable, FiberPool, Job, JobKilledException, Mutex
Constant Summary
collapse
- VERSION =
"0.0.5"
- JobKilled =
JobKilledException.new
Class Method Summary
collapse
Class Method Details
.defer ⇒ Object
18
19
20
|
# File 'lib/actuator.rb', line 18
def defer
FiberPool.run { yield }
end
|
.next_tick ⇒ Object
14
15
16
|
# File 'lib/actuator.rb', line 14
def next_tick
Timer.in(0) { yield }
end
|
.now ⇒ Object
117
118
119
120
|
# File 'ext/actuator/reactor.cpp', line 117
static VALUE Actuator_now(VALUE klass)
{
return DBL2NUM(clock_time());
}
|
.run ⇒ Object
10
11
12
|
# File 'lib/actuator.rb', line 10
def run
start { defer { yield } if block_given? }
end
|
.running? ⇒ Boolean
122
123
124
125
|
# File 'ext/actuator/reactor.cpp', line 122
static VALUE Actuator_is_running(VALUE klass)
{
return actuator->is_running ? Qtrue : Qfalse;
}
|
.start ⇒ Object
127
128
129
130
131
132
133
134
135
|
# File 'ext/actuator/reactor.cpp', line 127
static VALUE Actuator_start(VALUE klass)
{
if (actuator->is_running) {
if (rb_block_given_p()) rb_yield(Qundef);
} else {
actuator->Start();
}
return Qnil;
}
|
.stop ⇒ Object
137
138
139
140
141
|
# File 'ext/actuator/reactor.cpp', line 137
static VALUE Actuator_stop(VALUE klass)
{
actuator->Stop();
return Qnil;
}
|
.wake ⇒ Object
143
144
145
146
147
|
# File 'ext/actuator/reactor.cpp', line 143
static VALUE Actuator_wake(VALUE klass)
{
actuator->Wake();
return Qnil;
}
|