make sure that changes and queries that affect both legs are atomic from
an other thread.