Add fail check when pthread_create
Add more Thread debug comments.
Use thread_t to get correct thread id.
Add more comments.