Class: IO::Event::Selector::Select::Waiter

Inherits:
Struct
  • Object
show all
Defined in:
lib/io/event/selector/select.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#eventsObject

Returns the value of attribute events

Returns:

  • (Object)

    the current value of events



115
116
117
# File 'lib/io/event/selector/select.rb', line 115

def events
  @events
end

#fiberObject

Returns the value of attribute fiber

Returns:

  • (Object)

    the current value of fiber



115
116
117
# File 'lib/io/event/selector/select.rb', line 115

def fiber
  @fiber
end

#tailObject

Returns the value of attribute tail

Returns:

  • (Object)

    the current value of tail



115
116
117
# File 'lib/io/event/selector/select.rb', line 115

def tail
  @tail
end

Instance Method Details

#alive?Boolean

Returns:

  • (Boolean)


116
117
118
# File 'lib/io/event/selector/select.rb', line 116

def alive?
	self.fiber&.alive?
end

#each(&block) ⇒ Object



134
135
136
137
138
139
140
# File 'lib/io/event/selector/select.rb', line 134

def each(&block)
	if fiber = self.fiber
		yield fiber, self.events
	end
	
	self.tail&.each(&block)
end

#invalidateObject



130
131
132
# File 'lib/io/event/selector/select.rb', line 130

def invalidate
	self.fiber = nil
end

#transfer(events) ⇒ Object



120
121
122
123
124
125
126
127
128
# File 'lib/io/event/selector/select.rb', line 120

def transfer(events)
	if fiber = self.fiber
		self.fiber = nil
		
		fiber.transfer(events & self.events) if fiber.alive?
	end

	self.tail&.transfer(events)
end