~singpolyma/em_fiberscheduler

87a7b9265529b510315708cf68196e48bba2032f — Stephen Paul Weber 4 months ago f1997f8
Work around race condition

Only seems to come up on Ruby 3.0, but safe to do in any case
1 files changed, 7 insertions(+), 0 deletions(-)

M lib/em_fiberscheduler.rb
M lib/em_fiberscheduler.rb => lib/em_fiberscheduler.rb +7 -0
@@ 20,6 20,13 @@ module EventMachine
		end

		def run
			# After tails run, set reactor_running to false
			# this works around a race condition against next_tick
			# while shutting down
			EM.instance_variable_get(:@tails).unshift(lambda do
				EM.instance_variable_set(:@reactor_running, false)
			end)

			tick
			EM.run
		end