[ruby-core:87530] Re: [Ruby trunk Bug#14841] Very rarely IO#readpartial does not raise EOFError

From: Eric Wong <normalperson@...>
Date: 2018-06-20 10:36:41 UTC
List: ruby-core #87530
Eric Wong <normalperson@yhbt.net> wrote:
> mofezilla@gmail.com wrote:
> > https://bugs.ruby-lang.org/issues/14841
> 
> Can you test?

Sorry, right idea, bad patch (broke during "make exam")
This should work:
```
--- a/thread_sync.c
+++ b/thread_sync.c
@@ -289,8 +289,11 @@ rb_mutex_lock(VALUE self)
 	    th->vm->sleeper--;
 
 	    if (mutex->th == th) mutex_locked(th, self);
-
-	    RUBY_VM_CHECK_INTS_BLOCKING(th->ec);
+	    RUBY_VM_CHECK_INTS_BLOCKING(th->ec); /* may release mutex */
+	    if (!mutex->th) {
+		mutex->th = th;
+	        mutex_locked(th, self);
+	    }
 	}
     }
     return self;
```

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next