Refactored gr_msg_accepter and gr_tpd_thread_body.