Project

General

Profile

Actions

Bug #19407

open

2 threads taking from current ractor will hang forever

Added by luke-gru (Luke Gruber) almost 2 years ago. Updated almost 2 years ago.

Status:
Assigned
Target version:
-
[ruby-core:112206]

Description

In the current implementation of Ractors, it's possible to take from the current ractor. This could be useful
when co-ordinating threads:

t = Thread.new do
  obj = Ractor.current.take
  p obj # do some work with obj
end
t0 = Thread.new do
  obj = Ractor.current.take
  p obj # do some work with obj
end
Ractor.yield :go

However it hangs forever:

t = Thread.new do
  obj = Ractor.current.take
  p obj
end
t0 = Thread.new do
  obj = Ractor.current.take
  p obj
end
sleep 0.5

Should "self-take" be disabled, or was it designed to allow it but this is just a bug?

Actions

Also available in: Atom PDF

Like0
Like0