Class: Ori::Scope::ThreadLocalState

Inherits:
Object
  • Object
show all
Defined in:
lib/ori/scope.rb

Overview

Add thread-local state management

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeThreadLocalState

Returns a new instance of ThreadLocalState.



19
20
21
22
23
24
25
26
27
# File 'lib/ori/scope.rb', line 19

def initialize
  @fiber_ids = LazyHash.new
  @tasks = LazyHash.new
  @pending = LazyArray.new
  @readable = LazyHashSet.new
  @writable = LazyHashSet.new
  @waiting = LazyHash.new
  @blocked = LazyHash.new
end

Instance Attribute Details

#blockedObject (readonly)

Returns the value of attribute blocked.



11
12
13
# File 'lib/ori/scope.rb', line 11

def blocked
  @blocked
end

#fiber_idsObject (readonly)

Returns the value of attribute fiber_ids.



11
12
13
# File 'lib/ori/scope.rb', line 11

def fiber_ids
  @fiber_ids
end

#pendingObject (readonly)

Returns the value of attribute pending.



11
12
13
# File 'lib/ori/scope.rb', line 11

def pending
  @pending
end

#readableObject (readonly)

Returns the value of attribute readable.



11
12
13
# File 'lib/ori/scope.rb', line 11

def readable
  @readable
end

#tasksObject (readonly)

Returns the value of attribute tasks.



11
12
13
# File 'lib/ori/scope.rb', line 11

def tasks
  @tasks
end

#waitingObject (readonly)

Returns the value of attribute waiting.



11
12
13
# File 'lib/ori/scope.rb', line 11

def waiting
  @waiting
end

#writableObject (readonly)

Returns the value of attribute writable.



11
12
13
# File 'lib/ori/scope.rb', line 11

def writable
  @writable
end

Instance Method Details

#child_scopesObject



29
30
31
# File 'lib/ori/scope.rb', line 29

def child_scopes
  @child_scopes ||= Set.new
end

#child_scopes?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/ori/scope.rb', line 33

def child_scopes?
  defined?(@child_scopes) && !@child_scopes.empty?
end