Class: Smith::Workflow::Parallel::CancellationSignal

Inherits:
Struct
  • Object
show all
Defined in:
lib/smith/workflow/parallel.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCancellationSignal

Returns a new instance of CancellationSignal.



9
10
11
# File 'lib/smith/workflow/parallel.rb', line 9

def initialize
  super(false, Mutex.new)
end

Instance Attribute Details

#cancelledObject

Returns the value of attribute cancelled

Returns:

  • (Object)

    the current value of cancelled



8
9
10
# File 'lib/smith/workflow/parallel.rb', line 8

def cancelled
  @cancelled
end

#mutexObject

Returns the value of attribute mutex

Returns:

  • (Object)

    the current value of mutex



8
9
10
# File 'lib/smith/workflow/parallel.rb', line 8

def mutex
  @mutex
end

Instance Method Details

#cancel!Object



13
14
15
# File 'lib/smith/workflow/parallel.rb', line 13

def cancel!
  mutex.synchronize { self.cancelled = true }
end

#cancelled?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/smith/workflow/parallel.rb', line 17

def cancelled?
  mutex.synchronize { cancelled }
end