Replace the check_aperture API with one we can make thread-safe.