NAME

counter - A semaphore-like object for synchronizing across processes

SYNOPSIS

A counter is like an event, but with an integer that can be incremented, decremented, read, or written.

DESCRIPTION

Counter is a synchronization tool allowing processes to coordinate and synchronize their actions. A counter contains a signed 64-bit integer and is somewhat similar to a counting semaphore.

Counter is designed to be used with zx_object_wait_one(), zx_object_wait_many(), or zx_object_wait_async().

SIGNALS

In addition to the standard user signals (ZX_USER_SIGNAL_0 through ZX_USER_SIGNAL_7), counter has two signals that are automatically asserted/deasserted based on the value:

ZX_COUNTER_NON_POSITIVE indicates the value is less than or equal to zero.

ZX_COUNTER_POSITIVE indicates the value is greater than or equal to zero.

SYSCALLS

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-02-28 UTC.