Module: Ballast
- Defined in:
- lib/ballast/errors.rb,
lib/ballast.rb,
lib/ballast/version.rb,
lib/ballast/context.rb,
lib/ballast/operation.rb,
lib/ballast/configuration.rb,
lib/ballast/concerns/view.rb,
lib/ballast/concerns/ajax.rb,
lib/ballast/concerns/common.rb,
lib/ballast/operations_chain.rb,
lib/ballast/request_domain_matcher.rb,
lib/ballast/middlewares/default_host.rb,
lib/ballast/concerns/errors_handling.rb
Overview
This file is part of the ballast gem. Copyright (C) 2013 and above Shogun shogun@cowtech.it. Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.
Defined Under Namespace
Modules: Concerns, Errors, Middlewares, Version Classes: Configuration, Context, Operation, OperationsChain, RequestDomainMatcher
Class Method Summary (collapse)
-
+ (Object) in_em_thread(start_reactor = false, &block)
If running under eventmachine, run the block in a thread of its threadpool using EM::Synchrony, otherwise run the block normally.
Class Method Details
+ (Object) in_em_thread(start_reactor = false, &block)
If running under eventmachine, run the block in a thread of its threadpool using EM::Synchrony, otherwise run the block normally.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/ballast.rb', line 36 def self.in_em_thread(start_reactor = false, &block) if EM.reactor_running? then EM::Synchrony.defer do Fiber.new { block.call }.resume end elsif start_reactor then EM.synchrony do Ballast.in_em_thread(&block) EM.stop end else block.call end end |