Machinery to allow backends to safely have and stop background threads