diff options
author | kosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-05 19:37:37 +0000 |
---|---|---|
committer | kosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-05 19:37:37 +0000 |
commit | def63c3466939161f2459f6489815b444bbde8a3 (patch) | |
tree | 2d28e53a791ae47023aa2aa893e641896d08262a /io.c | |
parent | 84cfe8f8d669c3b8bdadc8a819d6482b890c5e24 (diff) | |
download | ruby-def63c3466939161f2459f6489815b444bbde8a3.tar.gz |
* io.c (io_binwrite): check interrupt before io issue.
* test/ruby/test_thread.rb (test_async_interrupt_and_io):
test for the above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38224 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -1120,6 +1120,9 @@ io_binwrite(VALUE str, const char *ptr, long len, rb_io_t *fptr, int nosync) { long n, r, offset = 0; + /* don't write anything if current thread has a pending interrupt. */ + rb_thread_check_ints(); + if ((n = len) <= 0) return n; if (fptr->wbuf.ptr == NULL && !(!nosync && (fptr->mode & FMODE_SYNC))) { fptr->wbuf.off = 0; |