|
Atomic locks aresynchronization primitivesthat are used to ensure thatbasic arithmetic and bit operationsare executed without preemption.
DDI atomic locks
The following atomic lock functions and structuresare supported in DDI version 6 and later versions:
ATOMIC_INT(D4)- definition of atomic_int structure
ATOMIC_INT_ALLOC(D3)- allocate an atomic_int object
ATOMIC_INT_INIT(D3)- initialize an atomic_int object
ATOMIC_INT_ADD(D3)- add to an atomic_int value
ATOMIC_INT_SUB(D3)- subtract from an atomic_int value
ATOMIC_INT_INCR(D3)- increment an atomic_int structure
ATOMIC_INT_DECR(D3)- decrement an atomic_int value
ATOMIC_INT_READ(D3)- read value stored within an atomic_int object
ATOMIC_INT_WRITE(D3)- write value into an atomic_int object
ATOMIC_INT_DEALLOC(D3)- free an atomic_int object
The atomicity properties of ATOMIC_INT objectsare strictly limited to a single object.Drivers should be careful not to assume any ordering of operationsbetween two instances of ATOMIC_INT objects,or between these objects and objectswhose access patterns are serialized by means of locks,unless such ordering is explicitly arranged forin the driver through use of locks.In particular, drivers should not assume that arbitrary writeswill 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),andATOMIC_INT_WRITE(D3).This means that the results of a set of these operationson multiple engines will appear as thoughthey had occurred in some specific order on a single engine.
ODDI atomic locks
SCO OpenServer 5 atomic locking functions are documentedon theatomic(D3oddi)manual page.The SCO OpenServer 5 atomic locks are a set of functionswhose names determine the operationand size of the arguments.The following tables show the full set ofSCO 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 | -- | -- | -- | -- |
OpenServer 6 and UnixWare (SVR5) HDK - June 2005