summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-15 05:18:37 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-15 05:18:37 +0000
commite9614f9a37cee98a2addcffed1ae5111f97ad5d9 (patch)
treea8a441f77f165eb7203c61816506aec576057beb /dir.c
parent1d7247e6941ed1630ad172834bbaaf25b968be02 (diff)
Cannot call rb_thread_call_without_gvl before running VM
* dir.c (readdir_without_gvl): check the VM is already initialized before calling rb_thread_call_without_gvl(). [Bug #14108] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60772 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/dir.c b/dir.c
index 519a3fce0a..73ea36d083 100644
--- a/dir.c
+++ b/dir.c
@@ -743,7 +743,6 @@ to_be_skipped(const struct dirent *dp)
return FALSE;
}
-#ifndef _WIN32
static void *
nogvl_readdir(void *ptr)
{
@@ -755,11 +754,11 @@ nogvl_readdir(void *ptr)
static struct dirent *
readdir_without_gvl(struct dir_data *dirp)
{
- return rb_thread_call_without_gvl(nogvl_readdir, dirp, RUBY_UBF_IO, 0);
+ if (rb_cThread) /* VM is running */
+ return rb_thread_call_without_gvl(nogvl_readdir, dirp, RUBY_UBF_IO, 0);
+ else
+ return READDIR(dirp->dir, dirp->enc);
}
-#else
-#define readdir_without_gvl(dirp) READDIR((dirp)->dir, (dirp)->enc)
-#endif
/*
* call-seq: