Use a pth_msgport_t for message passing. Also wait for an PTH_EVENT_MSG