1# zx_timer_cancel 2 3## NAME 4 5<!-- Updated by update-docs-from-abigen, do not edit. --> 6 7timer_cancel - cancel a timer 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_timer_cancel(zx_handle_t handle); 17``` 18 19## DESCRIPTION 20 21`zx_timer_cancel()` cancels a pending timer that was started with 22[`zx_timer_set()`]. 23 24Upon success the pending timer is canceled and the **ZX_TIMER_SIGNALED** 25signal is de-asserted. If a new pending timer is immediately needed 26rather than calling `zx_timer_cancel()` first, call [`zx_timer_set()`] 27with the new deadline. 28 29## RIGHTS 30 31<!-- Updated by update-docs-from-abigen, do not edit. --> 32 33*handle* must be of type **ZX_OBJ_TYPE_TIMER** and have **ZX_RIGHT_WRITE**. 34 35## RETURN VALUE 36 37`zx_timer_cancel()` returns **ZX_OK** on success. 38In the event of failure, a negative error value is returned. 39 40## ERRORS 41 42**ZX_ERR_BAD_HANDLE** *handle* is not a valid handle. 43 44**ZX_ERR_ACCESS_DENIED** *handle* lacks the right **ZX_RIGHT_WRITE**. 45 46## NOTE 47 48Calling this function before [`zx_timer_set()`] has no effect. 49 50## SEE ALSO 51 52 - [`zx_timer_create()`] 53 - [`zx_timer_set()`] 54 55<!-- References updated by update-docs-from-abigen, do not edit. --> 56 57[`zx_timer_create()`]: timer_create.md 58[`zx_timer_set()`]: timer_set.md 59