Summary
Write a value to a counter.
Declaration
#include <zircon/syscalls.h>
zx_status_t zx_counter_write(zx_handle_t handle, int64_t value);
Description
zx_counter_write() writes value to the counter referenced by handle,
asserting/deasserting signals as necessary. See zx_counter_add() for
the conditions on which signals are asserted/deasserted.
Because concurrent operations on a counter may be interleaved with one another,
an implementation of a "counting semaphore" synchronization protocol should use
zx_counter_add() instead of a sequence of zx_counter_read(), modify,
zx_counter_write().
Rights
handle must have ZX_RIGHT_WRITE.
Return value
zx_counter_write() returns ZX_OK on success.
On failure, an error value is returned.
Errors
ZX_ERR_WRONG_TYPE if handle is not a counter handle.
ZX_ERR_ACCESS_DENIED if handle does not have ZX_RIGHT_WRITE.
ZX_ERR_INVALID_ARGS if value is an invalid pointer.