From 62fd58480c95af5a58b68d002e52a4ac15788f97 Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 14 Jun 2015 08:20:43 +0000 Subject: file.c: open without gvl * 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/trunk@50887 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- file.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'file.c') diff --git a/file.c b/file.c index a9444029d2..026ed031a1 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 @@ -5621,11 +5622,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 -- cgit v1.2.3