Sha256: 2a4591650b029019e2a3ac05e71165839cdf9857a19986d64c9658348eeaa67d

Contents?: true

Size: 1.17 KB

Versions: 16

Compression:

Stored size: 1.17 KB

Contents

# -*- encoding: binary -*-
# :enddoc:
begin
  require 'fiber'
rescue LoadError
  defined?(NeverBlock) or raise
end

# core namespace for all things that use Fibers in \Rainbows!
#
# It's generally not recommended to use any of this in your applications
# unless you're willing to accept breakage.  Most of this is very
# difficult-to-use, fragile and we don't have much time to devote to
# supporting these in the future.
module Rainbows::Fiber

  # blocked readers (key: fileno, value: Rainbows::Fiber::IO object)
  RD = []

  # blocked writers (key: fileno, value: Rainbows::Fiber::IO object)
  WR = []

  # sleeping fibers go here (key: Fiber object, value: wakeup time)
  ZZ = {}

  # puts the current Fiber into uninterruptible sleep for at least
  # +seconds+.  Unlike Kernel#sleep, this it is not possible to sleep
  # indefinitely to be woken up (nobody wants that in a web server,
  # right?).  Calling this directly is deprecated, use
  # Rainbows.sleep(seconds) instead.
  def self.sleep(seconds)
    ZZ[Fiber.current] = Time.now + seconds
    Fiber.yield
  end

  autoload :Base, 'rainbows/fiber/base'
  autoload :Queue, 'rainbows/fiber/queue'
  autoload :IO, 'rainbows/fiber/io'
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
rainbows-4.7.0 lib/rainbows/fiber.rb
rainbows-4.6.2 lib/rainbows/fiber.rb
rainbows-4.6.1 lib/rainbows/fiber.rb
rainbows-4.6.0.4.g4108 lib/rainbows/fiber.rb
rainbows-4.6.0 lib/rainbows/fiber.rb
rainbows-4.5.0 lib/rainbows/fiber.rb
rainbows-4.4.3 lib/rainbows/fiber.rb
rainbows-4.4.2 lib/rainbows/fiber.rb
rainbows-4.4.1.1.gd5c8c lib/rainbows/fiber.rb
rainbows-4.4.1 lib/rainbows/fiber.rb
rainbows-4.4.0 lib/rainbows/fiber.rb
rainbows-4.3.1 lib/rainbows/fiber.rb
rainbows-4.3.0 lib/rainbows/fiber.rb
rainbows-4.2.0 lib/rainbows/fiber.rb
rainbows-4.1.0 lib/rainbows/fiber.rb
rainbows-4.0.0 lib/rainbows/fiber.rb