[ruby-cvs:68272] normal:r61091 (trunk): Dir#chdir keeps GVL if passed block

normal at ruby-lang.org normal at ruby-lang.org
Sat Dec 9 12:46:39 JST 2017


normal	2017-12-09 12:46:39 +0900 (Sat, 09 Dec 2017)

  New Revision: 61091

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61091

  Log:
    Dir#chdir keeps GVL if passed block
    
    On further examination, Dir.chdir with a block from multiple
    threads is thread-unsafe given our use of the chdir_blocking and
    chdir_thread global variables.
    
    This bug was only introduced in r60583 so not part of any stable
    release.
    
    Dir.chdir without a block can still make senses in a MT context
    as only one thread could be cwd-sensitive and other threads do
    not care which directory they're in.
    
    * dir.c (dir_chdir): keep GVL here
      (dir_s_chdir): release GVL if no block given

  Modified files:
    trunk/dir.c


More information about the ruby-cvs mailing list