• Monty's avatar
    Fixed possible mutex-wrong-order with KILL USER · 2fcb5d65
    Monty authored
    The old code collected a list of THD's, locked the THD's from getting
    deleted by locking two mutex and then later in a separate loop
    sent a kill signal to each THD.
    
    The problem with this approach is that, as THD's can be reused,
    the second time the THD is killed, the mutex can be taken in
    different order, which signals failures in safe_mutex.
    
    Fixed by sending the kill signal directly and not collect the THD's
    in a list to be signaled later.  This is the same approach we are using
    in kill_zombie_dump_threads().
    
    Other things:
    - Reset safe_mutex_t->locked_mutex when freed (Safety fix)
    2fcb5d65
thr_mutex.c 25.1 KB