Modify thread.c and thread.h