Sha256: 0a4698e77c81e6b96aa7dcc388cbe695c8a515858b6a11cee68ccfcccf15fa4d

Contents?: true

Size: 597 Bytes

Versions: 5

Compression:

Stored size: 597 Bytes

Contents

require 'celluloid/tasks/task_fiber'
require 'celluloid/tasks/task_thread'

module Celluloid
  # Trying to resume a dead task
  class DeadTaskError < StandardError; end

  # Tasks are interruptable/resumable execution contexts used to run methods
  module Task
    class TerminatedError < StandardError; end # kill a running task

    # Obtain the current task
    def self.current
      Thread.current[:task] or raise "not within a task context"
    end

    # Suspend the running task, deferring to the scheduler
    def self.suspend(status)
      Task.current.suspend(status)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
celluloid-0.12.1.pre lib/celluloid/task.rb
celluloid-0.12.0 lib/celluloid/task.rb
celluloid-0.12.0.pre3 lib/celluloid/task.rb
celluloid-0.12.0.pre2 lib/celluloid/task.rb
celluloid-0.12.0.pre lib/celluloid/task.rb