[前][次][番号順一覧][スレッド一覧]

ruby-changes:73956

From: Samuel <ko1@a...>
Date: Wed, 12 Oct 2022 11:56:54 +0900 (JST)
Subject: [ruby-changes:73956] 04d291a490 (master): Simplify implementation of scheduler `io_read` and `io_write`. (#6527)

https://git.ruby-lang.org/ruby.git/commit/?id=04d291a490

From 04d291a490517eb32ea02df636fc8f1f1ed57873 Mon Sep 17 00:00:00 2001
From: Samuel Williams <samuel.williams@o...>
Date: Wed, 12 Oct 2022 15:56:35 +1300
Subject: Simplify implementation of scheduler `io_read` and `io_write`.
 (#6527)

---
 test/fiber/scheduler.rb | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/test/fiber/scheduler.rb b/test/fiber/scheduler.rb
index ceed606338..322564fe6d 100644
--- a/test/fiber/scheduler.rb
+++ b/test/fiber/scheduler.rb
@@ -269,15 +269,14 @@ class IOBufferScheduler < Scheduler https://github.com/ruby/ruby/blob/trunk/test/fiber/scheduler.rb#L269
     total = 0
     io.nonblock = true
 
-    while length >= 0
+    while true
       maximum_size = buffer.size - offset
-
       result = blocking{buffer.read(io, maximum_size, offset)}
 
       if result > 0
         total += result
         offset += result
-        break if result >= length
+        break if total >= length
       elsif result == 0
         break
       elsif result == EAGAIN
@@ -298,15 +297,14 @@ class IOBufferScheduler < Scheduler https://github.com/ruby/ruby/blob/trunk/test/fiber/scheduler.rb#L297
     total = 0
     io.nonblock = true
 
-    while length >= 0
+    while true
       maximum_size = buffer.size - offset
-
       result = blocking{buffer.write(io, maximum_size, offset)}
 
       if result > 0
         total += result
         offset += result
-        break if result >= length
+        break if total >= length
       elsif result == 0
         break
       elsif result == EAGAIN
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]