Add a semaphore to stop concurrent modification of ArrayList

Since the discovery runs in a different Thread to the sketch, the
ArrayList was subject to ConcurrentModificationExceptions.