Fix bug: should not call pthread_join() if create thread failed.