Make the connection a read-write mutex instead of a regular one.
Take the write lock on a connection in the destructor.