ATOMIC_INT(D4) ATOMIC_INT(D4)
NAME
ATOMIC_INT - atomic integer
SYNOPSIS
#include <sys/types.h>
#include <sys/ksynch.h>
#include <sys/ddi.h>
DESCRIPTION
The ATOMIC_INT structure stores an integer value which 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(D4) objects must be allocated by
ATOMIC_INT_ALLOC(D3) and initialized by ATOMIC_INT_INIT(D3)
before they are used. They may be freed via
ATOMIC_INT_DEALLOC(D3).
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 arranged for 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.
Copyright 1994 Novell, Inc. Page 1
ATOMIC_INT(D4) ATOMIC_INT(D4)
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)
NOTICES
Portability
All processors
Copyright 1994 Novell, Inc. Page 2