about to move exit code to thread_exit
exit() code moved to thread_exit()