Sha256: 3ba44e3f3b0e00ab11c6d333c700265f5a993ace20c460d0820a2d56a734029a
Contents?: true
Size: 715 Bytes
Versions: 1
Compression:
Stored size: 715 Bytes
Contents
require 'celluloid/tasks/task_fiber' require 'celluloid/tasks/task_thread' module Celluloid # Asked to do task-related things outside a task class NotTaskError < StandardError; end # 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[:celluloid_task] or raise NotTaskError, "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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
celluloid-0.12.4.pre | lib/celluloid/task.rb |