From: "U.NAKAMURA" Date: 2017-11-15T16:41:22+09:00 Subject: [ruby-core:83781] Re: [Ruby trunk Bug#14108] Seg Fault with MinGW on svn 60769 Hi, Eric, In message "[ruby-core:83779] Re: [Ruby trunk Bug#14108] Seg Fault with MinGW on svn 60769" on Wed, 15 Nov 2017 07:12:42 +0000, normalperson@yhbt.net wrote: > > You can see our implementation of readdir on Windows in > > win32/win32.c (rb_w32_readdir). > > I doubt the second argument (rb_encoding *enc) is the cause. As Nobu said at [ruby-core:83776] (thank you Nobu!), my guess was wrong and the cause was touching GVL before running VM. Therefore r60770 is the right way to resolve the problem. > Right, enc is no problem. The problem is using DIR * from stdio > is not reentrant or thread-safe. readdir_r is deprecated, even, > and so it is up to the application to provide thread-safety when > reading directories. Our readdir implementation for Win32 is expected to be thread-safe. And, it seems that there is no platform which uses non thread-safe readdir. > Usually on modern platforms (but not guaranteed), readdir on > different DIR * pointers is safe from multiple threads, so maybe > we can add a mutex to "struct dir_data". > > I will revert r60772, r60770, and r60769 for now... So, IMO you don't need to revert them. (but this mail is too late...) Regards, -- U.Nakamaura Unsubscribe: