add deadlock safe term handler