[ruby-cvs:71445] normal:r64353 (trunk): thread_pthread: use POSIX timer or thread to get rid of races

normal at ruby-lang.org normal at ruby-lang.org
Tue Aug 14 06:34:24 JST 2018


normal	2018-08-14 06:34:24 +0900 (Tue, 14 Aug 2018)

  New Revision: 64353

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

  Log:
    thread_pthread: use POSIX timer or thread to get rid of races
    
    This closes race condition where GVL is uncontended and a thread
    receives a signal immediately before calling the blocking
    function when releasing GVL:
    
    1) check interrupts
    2) release GVL
    3) blocking function
    
    If signal fires after 1) but before 3), that thread may never
    wake up if GVL is uncontended
    
    We also need to wakeup the ubf_list unconditionally on
    gvl_yield; because two threads can be yielding to each other
    while waiting on IO#close while waiting on threads in IO#read or
    IO#gets.
    
    [ruby-core:88360] [Misc #14937]

  Modified files:
    trunk/configure.ac
    trunk/thread_pthread.c


More information about the ruby-cvs mailing list