ruby-changes:48656
From: usa <ko1@a...>
Date: Wed, 15 Nov 2017 14:18:44 +0900 (JST)
Subject: [ruby-changes:48656] usa:r60772 (trunk): Cannot call rb_thread_call_without_gvl before running VM
usa 2017-11-15 14:18:37 +0900 (Wed, 15 Nov 2017) New Revision: 60772 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60772 Log: 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] Modified files: trunk/dir.c Index: dir.c =================================================================== --- dir.c (revision 60771) +++ dir.c (revision 60772) @@ -743,7 +743,6 @@ to_be_skipped(const struct dirent *dp) https://github.com/ruby/ruby/blob/trunk/dir.c#L743 return FALSE; } -#ifndef _WIN32 static void * nogvl_readdir(void *ptr) { @@ -755,11 +754,11 @@ nogvl_readdir(void *ptr) https://github.com/ruby/ruby/blob/trunk/dir.c#L754 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: -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/