thread.c updated