Fixed thread_delete to delete current thread.