HDK Technical Reference

Atomic locks

Atomic locks are synchronization primitives that are used to ensure that basic arithmetic and bit operations are executed without preemption.

DDI atomic locks

The following atomic lock functions and structures are 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 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.

ODDI atomic locks

SCO OpenServer atomic locking functions are documented on the atomic(D3oddi) manual page. The SCO OpenServer 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 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

 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

 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 -- -- -- --

 Operation   |  long    ulong    int     uint     short   ushort   char   uchar
 bit test/set|  qbtsl   qbtsul   qbtsi   qbtsui   --      --       --     --

© 2000 The Santa Cruz Operation, Inc. All rights reserved.
HDK 7.1.0b - 15 March 2000