[ruby-cvs:73558] normal:r66457 (trunk): thread_pthread.c (ubf_timer_disarm): ignore EINVAL iff timer is dead

normal at ruby-lang.org normal at ruby-lang.org
Thu Dec 20 09:07:19 JST 2018

normal	2018-12-20 09:07:19 +0900 (Thu, 20 Dec 2018)

  New Revision: 66457


    thread_pthread.c (ubf_timer_disarm): ignore EINVAL iff timer is dead
    The following race may happen if ubf_timer_destroy calls
    timer_delete before ubf_timer_disarm gets called from
    a different thread.  Consider the following timelines:
      ubf_timer_destroy                    | ubf_timer_disarm
                                           | CAS(ARM => DISARM)
      CAS(DISARM => DEAD)                  |
      timer_delete                         |
                                           | timer_settime(disarm)
    Another option may be to add an intermediate "RTIMER_DISARMING"
    state to the transition, but I figure the EINVAL check is
    simpler and less intrusive code-wise.
    cf. http://ci.rvm.jp/results/trunk-iseq_binary@silicon-docker/1545794

  Modified files:

More information about the ruby-cvs mailing list