-
-
Notifications
You must be signed in to change notification settings - Fork 103
Open
Description
I have still no idea how to stop a Fiber from running (unschedule).
I was told that i can raise an exception, but it is not working as i hoped.
Can you help me how to do that?
In this code i was expecting @fib1 to exit, but it does not exit ever.
Do I have any alternative options?
require 'async'
Fiber.set_scheduler(Async::Scheduler.new)
@fib1 = Fiber.schedule do
puts 'entering fiber 1'
sleep 1
@fib2.raise
puts 'exiting fiber 1'
end
@fib2 = Fiber.schedule do
puts 'entering fiber 2'
begin
sleep 4
rescue
puts 'got exception'
end
puts 'exiting fiber 2'
end
Metadata
Metadata
Assignees
Labels
No labels