Function macro
Atomically increments a place containing a numeric value.
atomic-increment!(place);
atomic-increment!(place, by);
If the implementation provides the extended form of conditional-update!, place can also be a function call.
<object>. Default value: 1.
<object>.
threads
threads
Atomically increments a place containing a numeric value.
The value of the place is evaluated one or more times to determine the initial value. A new value is computed from this value and by, by applying + from the Dylan module. The new value is atomically stored back into place.
The macro returns the new value of place.
The place must be a suitable place for conditional-update!.
Implementations of atomic-increment! are permitted to use conditional-update! (as in the described example), and hence can involve a loop and can cause place to be evaluated more than once. However, an atomic increment of a locked variable might be implemented by a more efficient non-looping mechanism on some platforms.
The following example atomically increments *number-detected* by 2, and returns the incremented value.
atomic-increment!(*number-detected*, 2);