I\'m writing a program which maintains a state in the State object. Every time the state changes, a new thread in this program is created and a callback function is called o