Project

General

Profile

Actions

Bug #18484

closed

Fiber should return it self when blocked by IO

Added by jakit (Jakit Liang) 4 months ago. Updated about 2 months ago.

Status:
Rejected
Priority:
Normal
Target version:
-
ruby -v:
ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [arm64-darwin20]
[ruby-core:107097]

Description

Here's an example:

f = Fiber.new do
  sleep(1)
  Fiber.yield 123
end

p f.resume

Output:

nil

Expected output:

#<Fiber:0x000000010e825b18@(irb):59 (paused)>

========================

In JavaScipt, an example like:

async function testAsync() {
    return "hello async";
}

const result = testAsync();
console.log(result);

Output:

Promise { 'hello async' }

Updated by mame (Yusuke Endoh) 4 months ago

  • Assignee set to ioquatix (Samuel Williams)

Updated by ioquatix (Samuel Williams) 4 months ago

irb(main):001:1* f = Fiber.new do
irb(main):002:1*   sleep(1)
irb(main):003:1*   Fiber.yield 123
irb(main):004:0> end
=> #<Fiber:0x000000010d8aa328 (irb):1 (created)>
irb(main):005:0> 
irb(main):006:0> p f.resume
123
=> 123
irb(main):007:0> 

This appears to work fine to me. Can you please give a more detailed example.

Actions #3

Updated by jeremyevans0 (Jeremy Evans) about 2 months ago

  • Status changed from Open to Rejected
Actions

Also available in: Atom PDF