ATOMIC_INT(D4)
ATOMIC_INT --
atomic integer
Syntax
#include <sys/types.h>
#include <sys/ksynch.h>
#include <sys/ddi.h>
typedef atomic_int_t;
Description
The ATOMIC_INT structure stores an integer value
that can be atomically accessed from multiple engines.
Within a processor family,
the precision of the value stored
in the ATOMIC_INT is at least as great
as the data type int.
Usage
An ATOMIC_INT structure,
an atomic_int_t,
can be used by a driver to keep a consistent counter value
across multiple engines without the need to acquire locks.
Specifically, for any single ATOMIC_INT object,
the following operations on that object are serialized:
ATOMIC_INT_ADD(D3),
ATOMIC_INT_DECR(D3),
ATOMIC_INT_INCR(D3),
ATOMIC_INT_READ(D3),
ATOMIC_INT_SUB(D3),
and
ATOMIC_INT_WRITE(D3).
This means that the results of a set of these operations on multiple
engines will appear as though they had occurred in some specific order on a
single engine.
The ATOMIC_INT objects must be allocated by the
ATOMIC_INT_ALLOC(D3)
function and initialized by the
ATOMIC_INT_INIT(D3)
function before they are used.
They may be freed with the
ATOMIC_INT_DEALLOC(D3)
function.
Warnings
The atomicity properties of ATOMIC_INT objects
(as defined in the section above)
are strictly limited to a single object.
Drivers should be careful not to assume
any ordering of operations between two instances
of ATOMIC_INT objects,
or between these objects and objects
whose access patterns are serialized by means of locks,
unless such ordering is explicitly set up in the driver
through use of locks.
In particular, drivers should not assume that arbitrary writes
will be observed in any particular order by another engine.
Structure definition
The ATOMIC_INT structure contains no driver accessible fields.
Applicable hardware
All
Version applicability
ddi:
6, 6mp, 7, 7mp, 7.1, 7.1mp, 8, 8mp
Difference between versions
References
ATOMIC_INT_ADD(D3),
ATOMIC_INT_ALLOC(D3),
ATOMIC_INT_DEALLOC(D3),
ATOMIC_INT_DECR(D3),
ATOMIC_INT_INCR(D3),
ATOMIC_INT_INIT(D3),
ATOMIC_INT_READ(D3),
ATOMIC_INT_SUB(D3),
ATOMIC_INT_WRITE(D3)
19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005