Increments a variable atomically.
Item | Description |
---|---|
addr | Specifies the address of the variable to be incremented. |
value | Specifies the value to be added to the variable. |
The fetch_and_add kernel services atomically increment a variable.
The fetch_and_add kernel service operates on a single word (32 bit) variable while the fetch_and_addlp kernel service operates on a double word (64 bit) variable.
These operations are useful when a counter variable is shared between several kernel threads, because it ensures that the fetch, update, and store operations used to increment the counter occur atomically (are not interruptible).
The fetch_and_add kernel services can be called from either the process or interrupt environment.
The fetch_and_add kernel services return the original value of the variable.