diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-10-16 06:54:38 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-10-16 06:54:38 +0000 |
commit | 53e2aa5e3dcaad7d6b55f3c8cb43a7935b036fa4 (patch) | |
tree | af6cb33b4cea4c9cbfae9bbd3149f115103d4b0e /win32 | |
parent | 8008992e404a90c469cebca8f42fed59618944a7 (diff) | |
download | ruby-53e2aa5e3dcaad7d6b55f3c8cb43a7935b036fa4.tar.gz |
file.c: non-blocking open
* file.c (rb_file_load_ok): open in non-blocking mode withoout
releasing GVL. don't care about others than regular files and
directories. [ruby-dev:49272] [Bug #11559]
* ruby.c (load_file_internal): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-rw-r--r-- | win32/file.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/win32/file.c b/win32/file.c index 5eb9eb98b7..46a7ec7d5d 100644 --- a/win32/file.c +++ b/win32/file.c @@ -4,7 +4,6 @@ #endif #include "ruby/ruby.h" #include "ruby/encoding.h" -#include "ruby/thread.h" #include "internal.h" #include <winbase.h> #include <wchar.h> @@ -700,14 +699,6 @@ rb_readlink(VALUE path, rb_encoding *resultenc) return str; } -static void * -loadopen_func(void *wpath) -{ - return (void *)CreateFileW(wpath, GENERIC_READ, - FILE_SHARE_READ | FILE_SHARE_WRITE, - NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); -} - int rb_file_load_ok(const char *path) { @@ -725,8 +716,9 @@ rb_file_load_ok(const char *path) ret = 0; } else { - HANDLE h = (HANDLE)rb_thread_call_without_gvl(loadopen_func, (void *)wpath, - RUBY_UBF_IO, 0); + HANDLE h = CreateFileW(wpath, GENERIC_READ, + FILE_SHARE_READ | FILE_SHARE_WRITE, + NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (h != INVALID_HANDLE_VALUE) { CloseHandle(h); } |