summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-04 14:24:21 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-04 14:24:21 +0000
commit315390097355992c6c671c8b956fa6951ef36569 (patch)
treee0577cb3e7defa2c13bf7366252e40bc22c7eb47 /file.c
parent7b2a41d317d12abcb25a1d5e710b36b419859e9d (diff)
merge revision(s) 50887,50896,50902: [Backport #11060]
* file.c (rb_file_load_ok): try opening file without gvl not to lock entire process. [Bug #11060] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@51143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'file.c')
-rw-r--r--file.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/file.c b/file.c
index 37315060e9..625ec2fc40 100644
--- a/file.c
+++ b/file.c
@@ -26,6 +26,7 @@
#include "internal.h"
#include "ruby/io.h"
#include "ruby/util.h"
+#include "ruby/thread.h"
#include "dln.h"
#ifdef HAVE_UNISTD_H
@@ -5599,11 +5600,19 @@ rb_path_check(const char *path)
}
#ifndef _WIN32
+static void *
+loadopen_func(void *arg)
+{
+ return (void *)(VALUE)rb_cloexec_open((const char *)arg, O_RDONLY, 0);
+}
+
int
rb_file_load_ok(const char *path)
{
int ret = 1;
- int fd = rb_cloexec_open(path, O_RDONLY, 0);
+ int fd;
+
+ fd = (int)(VALUE)rb_thread_call_without_gvl(loadopen_func, (void *)path, RUBY_UBF_IO, 0);
if (fd == -1) return 0;
rb_update_max_fd(fd);
#if !defined DOSISH