Define a structure to keep track of the thread