pTAL Reference Manual (H06.08+)
Built-In Routines
HP pTAL Reference Manual—523746-006
15-5
$ATOMIC_ADD
$ATOMIC_ADD
$ATOMIC_ADD atomically adds two INT values.
var input,output
sINT:variable
is the variable that $ATOMIC_ADD increments.
value input
sINT:value
is the value $ATOMIC_ADD adds to var.
$ATOMIC_ADD performs the following operation:
var := var + value
The read, add, and store operations are performed without interruption, as if the three
operations were one.
The following table shows examples of $ATOMIC_ADD:
Sets condition code Yes (according the final value of var )
Sets $CARRY Yes, if traps are disabled
Sets $OVERFLOW Yes, if traps are disabled; otherwise, traps on overflow
Example 15-3. $ATOMIC_ADD Routine
INT var;
INT value;
$ATOMIC_ADD (var, value);
var value result
%H1234 %HAAAA %HBCDE
%H1234 %H5555 %H6789
%H6789 %HAAAA %H1233
%H6789 %H5555 %HBCDE
$ATOMIC_ADD ( ) ;
VST607.vsd
var
,
value










