MsgQueue: using swap() to reduce unnessesary memory copy