Add a mutex to prevent corruption of the send and receive queues.