Lock the memory mutex later. Less locking if the second check finds the thread hasn't actually timed out.
module_malloc: the malloc call itself also needs to be guarded by the mutex, otherwise the kill signal could be received between malloc and the lock