<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.10.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Dispatch",
  "identifier" : "/documentation/Dispatch/dispatch_block_testcancel",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Dispatch"
    ],
    "preciseIdentifier" : "c:@F@dispatch_block_testcancel"
  },
  "title" : "dispatch_block_testcancel"
}
-->

# dispatch_block_testcancel

Tests whether the given dispatch block has been canceled.

```
extern intptr_t dispatch_block_testcancel(dispatch_block_t block);
```

## Parameters

`block`

The dispatch block to test cancel.

    The result of passing     `NULL`     or a block object not returned by the [`dispatch_block_create`](/documentation/Dispatch/dispatch_block_create)     or [`dispatch_block_create_with_qos_class`](/documentation/Dispatch/dispatch_block_create_with_qos_class)     function is undefined.

## Return Value

Returns a non-zero value if the dispatch block is canceled, otherwise zero.

## Discussion

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)