1# zx_interrupt_destroy
2
3## NAME
4
5<!-- Updated by update-docs-from-abigen, do not edit. -->
6
7interrupt_destroy - destroys an interrupt object
8
9## SYNOPSIS
10
11<!-- Updated by update-docs-from-abigen, do not edit. -->
12
13```
14#include <zircon/syscalls.h>
15
16zx_status_t zx_interrupt_destroy(zx_handle_t handle);
17```
18
19## DESCRIPTION
20
21`zx_interrupt_destroy()` "destroys" an interrupt object, putting it in a state
22where any [`zx_interrupt_wait()`] operations on it will return **ZX_ERR_CANCELED**,
23and it is unbound from any ports it was bound to.
24
25This provides a clean shut down mechanism.  Closing the last handle to the
26interrupt object results in similar cancellation but could result in use-after-close
27of the handle.
28
29If the interrupt object is bound to a port when cancellation happens, if it
30has not yet triggered, or it has triggered but the packet has not yet been
31received by a caller of [`zx_port_wait()`], success is returned and any packets
32in flight are removed.  Otherwise, **ZX_ERR_NOT_FOUND** is returned, indicating
33that the packet has been read but the interrupt has not been re-armed by calling
34[`zx_interrupt_ack()`].
35
36## RIGHTS
37
38<!-- Updated by update-docs-from-abigen, do not edit. -->
39
40TODO(ZX-2399)
41
42## RETURN VALUE
43
44`zx_interrupt_destroy()` returns **ZX_OK** on success. In the event
45of failure, a negative error value is returned.
46
47## ERRORS
48
49**ZX_ERR_BAD_HANDLE** *handle* is an invalid handle.
50
51**ZX_ERR_WRONG_TYPE** *handle* is not an interrupt object.
52
53**ZX_ERR_NOT_FOUND**  *handle* was bound (and now no longer is) but was not
54being waited for.
55
56**ZX_ERR_ACCESS_DENIED** *handle* lacks **ZX_RIGHT_WRITE**.
57
58## SEE ALSO
59
60 - [`zx_handle_close()`]
61 - [`zx_interrupt_ack()`]
62 - [`zx_interrupt_bind()`]
63 - [`zx_interrupt_create()`]
64 - [`zx_interrupt_trigger()`]
65 - [`zx_interrupt_wait()`]
66 - [`zx_port_wait()`]
67
68<!-- References updated by update-docs-from-abigen, do not edit. -->
69
70[`zx_handle_close()`]: handle_close.md
71[`zx_interrupt_ack()`]: interrupt_ack.md
72[`zx_interrupt_bind()`]: interrupt_bind.md
73[`zx_interrupt_create()`]: interrupt_create.md
74[`zx_interrupt_trigger()`]: interrupt_trigger.md
75[`zx_interrupt_wait()`]: interrupt_wait.md
76[`zx_port_wait()`]: port_wait.md
77