---
title: dispatch_block_testcancel
framework: dispatch
role: symbol
role_heading: Function
path: dispatch/dispatch_block_testcancel
---

# dispatch_block_testcancel

Tests whether the given dispatch block has been canceled.

## Declaration

```occ
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 doc://com.apple.dispatch/documentation/Dispatch/dispatch_block_create or doc://com.apple.dispatch/documentation/Dispatch/dispatch_block_create_with_qos_class function is undefined.

## Return Value

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

## See Also

### Canceling a Work Item

- [dispatch_block_cancel](dispatch/dispatch_block_cancel.md)
