summaryrefslogtreecommitdiff
path: root/win32/file.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-16 06:54:38 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-16 06:54:38 +0000
commitabf832f4357b02ab40a1bbcb6e59bbc1c35d2817 (patch)
treeaf6cb33b4cea4c9cbfae9bbd3149f115103d4b0e /win32/file.c
parent6291c6ad77a0587d3d7d5461d969f1bc9bbe866d (diff)
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/file.c')
-rw-r--r--win32/file.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/win32/file.c b/win32/file.c
index 5eb9eb98b7c..46a7ec7d5d5 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);
}