qthread_incr - Man Page
atomically increment a value
Synopsis
#include <qthread.h>
aligned_t
qthread_incr (aligned_t *operand, int incr);
float
qthread_fincr (float *operand, float incr);
double
qthread_dincr (double *operand, double incr);
Description
This function atomically increments the variable pointed to by operand by incr. In short, this is a thread-safe version of:
*operand += incr;
This function uses architecture-specific assembly to achieve this, but on unrecognized hardware will fall back to using qthread_lock() and qthread_unlock() to be thread-safe. Ordinarily, however, it does not use any of the available address locking mechanisms. There are exceptions. On 32-bit PowerPC, which has 64-bit doubles but does not have a 64-bit atomic load-and-reserve-word instruction. On this architecture we're forced to use qthread_lock() and qthread_unlock().
Return Value
These functions will return the value *operand had before the increment was performed.