Modified thread.c and Doc