{
  "slug": "anyio-cancellation-shielding",
  "version": 1,
  "project": "anyio",
  "title": "AnyIO cancellation shielding",
  "description": "A shielded inner cancel scope protects its work from outer cancellation while active. Cancellation initiated within the inner scope still applies. Leaving the shield restores the surrounding cancellation context.",
  "config": {
    "design": "architecture-nested-containers-routed-links-logo-nodes",
    "name": "cancellation-shielding",
    "style": "clean",
    "palette": [
      "#2d6a76"
    ],
    "parameters": {
      "groups": [
        {
          "id": "outer",
          "name": "Outer cancel scope",
          "description": "Cancellation remains active"
        },
        {
          "id": "shield",
          "name": "CancelScope(shield=True)",
          "description": "Own cancel() still applies",
          "parent": "outer"
        }
      ],
      "nodes": [
        {
          "id": "outercancel",
          "label": "outer.cancel()",
          "icon": "tabler:circle-x",
          "group": "outer"
        },
        {
          "id": "normal",
          "label": "Unshielded await",
          "description": "Cancelled at a yield point",
          "icon": "tabler:clock",
          "group": "outer"
        },
        {
          "id": "protected",
          "label": "Shielded await",
          "description": "Outer cancel blocked",
          "icon": "tabler:shield",
          "group": "shield"
        }
      ],
      "edges": [
        {
          "from": "outercancel",
          "to": "normal"
        }
      ]
    },
    "accessibility": {
      "title": "AnyIO cancellation shielding",
      "description": "A shielded inner cancel scope protects its work from outer cancellation while active. Cancellation initiated within the inner scope still applies. Leaving the shield restores the surrounding cancellation context."
    }
  },
  "files": {
    "svg": {
      "url": "/diagram-sources/anyio-cancellation-shielding/v1/diagram.svg",
      "sha256": "e32cc2673b7c0d523fefa6ee216e1ff2a2cf7f8fcf07f2f445fe3c9380524e89"
    },
    "png": {
      "url": "/diagram-sources/anyio-cancellation-shielding/v1/diagram.png",
      "sha256": "a961b57574f0cee21c413a45e41de313030cb5d112a126e850550a6f6c46c393"
    }
  }
}
