class Mosquito::Runner
- Mosquito::Runner
- Reference
- Object
Overview
This singleton class serves as a shorthand for starting and managing an Overseer.
A minimal usage of Mosquito::Runner is:
require "mosquito"
# When the process receives sigint, it'll notify the overseer to shut down gracefully.
trap("INT") do
Mosquito::Runner.stop(wait: true)
end
# Starts the overseer, and holds the thread captive.
Mosquito::Runner.start
If for some reason you want to manage an overseer or group of overseers yourself, Mosquito::Runner can be omitted entirely:
require "mosquito"
mosquito = Mosquito::Overseer.new
# Spawns a mosquito managed fiber and returns immediately
mosquito.run
trap "INT" do
mosquito.stop.receive
end
Defined in:
mosquito/runner.crConstant Summary
-
Log =
::Log.for(self)
Class Method Summary
-
.start(spin = true)
Start the mosquito runner.
-
.stop(wait = false)
Request the mosquito runner stop.
Class Method Detail
def self.start(spin = true)
#
Start the mosquito runner.
If spin = true (default) the function will not return until the runner is shut down. Otherwise it will return immediately.
def self.stop(wait = false)
#
Request the mosquito runner stop. The runner will not abort the current job but it will not start any new jobs.