change recv queue to use lock, add msg loop