|
|
Atomic locks are synchronization primitives that are used to ensure that basic arithmetic and bit operations are executed without preemption.
The following atomic lock functions and structures are supported in DDI version 6 and later versions:
The atomicity properties of ATOMIC_INT objects 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.
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.
SCO OpenServer 5 atomic locking functions are documented on the atomic(D3oddi) manual page. The SCO OpenServer 5 atomic locks are a set of functions whose names determine the operation and size of the arguments. The following tables show the full set of SCO OpenServer 5 quick lock functions:
Quick locks with two parameters -- qaddl(void,long)
Operation | long | ulong | int | uint | short | ushort | char | uchar |
addition | qaddl | qaddul | qaddi | qaddui | qaddw | qadduw | qaddb | qaddub |
subtraction | qsubl | qsubul | qsubi | qsubui | qsubw | qsubuw | qsubb | qsubub |
and | qandl | qandul | qandi | qandui | qandw | qanduw | qandb | qandub |
exchange | qxchgl | qxchgul | qxchgi | qxchgui | qxchgw | qxchguw | qxchgb | qxchgub |
or | qorl | qorul | qori | qorui | qorw | qoruw | qorb | qorub |
Quick locks with one parameter --qincl(void)
Operation | long | ulong | int | uint | short | ushort | char | uchar |
increment | qincl | qincul | qinci | qincui | qincw | qincuw | qincb | qincub |
decrement | qdecl | qdecul | qdeci | qdecui | qdecw | qdecuw | qdecb | qdecub |
zero | qzerol | qzeroul | qzeroi | qzeroui | qzerow | qzerouw | qzerob | qzeroub |
Bit test/set locks
Operation | long | ulong | int | uint | short | ushort | char | uchar |
bit test/set | qbtsl | qbtsul | qbtsi | qbtsui | -- | -- | -- | -- |