A thermocouple in a gas furnace is a safety device that: