Move the panicking flag to a thread local