synchronizing access to the two lists. each list is used as a lock to prevent access while it is currently being modified