⚲
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
Ruby master
All Projects
Ruby
»
Ruby master
Overview
Activity
Roadmap
Issues
Repository
Like
Download (377 Bytes)
Feature #13821
» fiber_across_threads.rb
reproduction code -
cremes (Chuck Remes)
, 08/16/2017 05:01 PM
queue
=
Queue
.
new
threadA
=
Thread
.
new
do
fiber
=
Fiber
.
new
do
puts
"Created in ThreadA"
val
=
Fiber
.
yield
puts
"Resumed in ThreadB with val
#{
val
}
"
end
fiber
.
resume
queue
<<
fiber
end
threadB
=
Thread
.
new
do
fiber
=
queue
.
pop
fiber
.
resume
(
3
)
end
threadA
.
join
threadB
.
join
# Expect this output:
# Created in ThreadA
# Resumed in ThreadB with val 3
« Previous
1
2
Next »
(1-1/2)
Loading...