Atomic locks (2024)

DOC HOMESITE MAPMAN PAGESGNU INFOSEARCHPRINT BOOK

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(voidAtomic locks (1),long)

Operationlongulongintuintshortushortcharuchar
additionqaddlqaddulqaddiqadduiqaddwqadduwqaddbqaddub
subtractionqsublqsubulqsubiqsubuiqsubwqsubuwqsubbqsubub
andqandlqandulqandiqanduiqandwqanduwqandbqandub
exchangeqxchglqxchgulqxchgiqxchguiqxchgwqxchguwqxchgbqxchgub
orqorlqorulqoriqoruiqorwqoruwqorbqorub

Quick locks with one parameter --qincl(voidAtomic locks (2))

Operationlongulongintuintshortushortcharuchar
incrementqinclqinculqinciqincuiqincwqincuwqincbqincub
decrementqdeclqdeculqdeciqdecuiqdecwqdecuwqdecbqdecub
zeroqzerolqzeroulqzeroiqzerouiqzerowqzerouwqzerobqzeroub

Bit test/set locks

Operationlongulongintuintshortushortcharuchar
bit test/setqbtslqbtsulqbtsiqbtsui--------
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005
Atomic locks (2024)
Top Articles
Latest Posts
Article information

Author: Kelle Weber

Last Updated:

Views: 6196

Rating: 4.2 / 5 (73 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Kelle Weber

Birthday: 2000-08-05

Address: 6796 Juan Square, Markfort, MN 58988

Phone: +8215934114615

Job: Hospitality Director

Hobby: tabletop games, Foreign language learning, Leather crafting, Horseback riding, Swimming, Knapping, Handball

Introduction: My name is Kelle Weber, I am a magnificent, enchanting, fair, joyous, light, determined, joyous person who loves writing and wants to share my knowledge and understanding with you.