/usr/local/google/home/srhines/android_trees/jb-mr2-dev/frameworks/rs/scriptc/rs_atomic.rsh File Reference

- Overview
- Globals
- Structs

Functions
/usr/local/google/home/srhines/android_trees/jb-mr2-dev/frameworks/rs/scriptc/rs_atomic.rsh File Reference

## Functions
int32_t | rsAtomicInc (volatile int32_t *addr)
uint32_t | rsAtomicInc (volatile uint32_t *addr)
int32_t | rsAtomicDec (volatile int32_t *addr)
uint32_t | rsAtomicDec (volatile uint32_t *addr)
int32_t | rsAtomicAdd (volatile int32_t *addr, int32_t value)
uint32_t | rsAtomicAdd (volatile uint32_t *addr, uint32_t value)
int32_t | rsAtomicSub (volatile int32_t *addr, int32_t value)
uint32_t | rsAtomicSub (volatile uint32_t *addr, uint32_t value)
int32_t | rsAtomicAnd (volatile int32_t *addr, int32_t value)
uint32_t | rsAtomicAnd (volatile uint32_t *addr, uint32_t value)
int32_t | rsAtomicOr (volatile int32_t *addr, int32_t value)
uint32_t | rsAtomicOr (volatile uint32_t *addr, uint32_t value)
uint32_t | rsAtomicXor (volatile uint32_t *addr, uint32_t value)
int32_t | rsAtomicXor (volatile int32_t *addr, int32_t value)
uint32_t | rsAtomicMin (volatile uint32_t *addr, uint32_t value)
int32_t | rsAtomicMin (volatile int32_t *addr, int32_t value)
uint32_t | rsAtomicMax (volatile uint32_t *addr, uint32_t value)
int32_t | rsAtomicMax (volatile int32_t *addr, int32_t value)
int32_t | rsAtomicCas (volatile int32_t *addr, int32_t compareValue, int32_t newValue)
uint32_t | rsAtomicCas (volatile uint32_t *addr, uint32_t compareValue, uint32_t newValue)

## Detailed Description

Atomic routines.

Definition in file rs_atomic.rsh.

## Function Documentation

int32_t rsAtomicAdd | ( | volatile int32_t * | addr,
|  | int32_t | value
| ) |  |

Atomic add a value to the value at addr. addr[0] += value

Parameters:

  addr | Address of value to modify
  value | Amount to add to the value at addr

Returns:
  old value

uint32_t rsAtomicAdd | ( | volatile uint32_t * | addr,
|  | uint32_t | value
| ) |  |

Atomic add a value to the value at addr. addr[0] += value

Parameters:

  addr | Address of value to modify
  value | Amount to add to the value at addr

Returns:
  old value

int32_t rsAtomicAnd | ( | volatile int32_t * | addr,
|  | int32_t | value
| ) |  |

Atomic Bitwise and a value from the value at addr. addr[0] &= value

Parameters:

  addr | Address of value to modify
  value | Amount to and with the value at addr

Returns:
  old value

uint32_t rsAtomicAnd | ( | volatile uint32_t * | addr,
|  | uint32_t | value
| ) |  |

Atomic Bitwise and a value from the value at addr. addr[0] &= value

Parameters:

  addr | Address of value to modify
  value | Amount to and with the value at addr

Returns:
  old value

int32_t rsAtomicCas | ( | volatile int32_t * | addr,
|  | int32_t | compareValue,
|  | int32_t | newValue
| ) |  |

Compare-and-set operation with a full memory barrier.

If the value at addr matches compareValue then newValue is written.

Parameters:

  addr | The address to compare and replace if the compare passes.
  compareValue | The value to test addr[0] against.
  newValue | The value to write if the test passes.

Returns:
  old value

uint32_t rsAtomicCas | ( | volatile uint32_t * | addr,
|  | uint32_t | compareValue,
|  | uint32_t | newValue
| ) |  |

Compare-and-set operation with a full memory barrier.

If the value at addr matches compareValue then newValue is written.

Parameters:

  addr | The address to compare and replace if the compare passes.
  compareValue | The value to test addr[0] against.
  newValue | The value to write if the test passes.

Returns:
  old value

int32_t rsAtomicDec | ( | volatile int32_t * | addr | ) |

Atomic subtract one from the value at addr. Equal to rsAtomicSub(addr, 1)

Parameters:

  addr | Address of value to decrement

Returns:
  old value

uint32_t rsAtomicDec | ( | volatile uint32_t * | addr | ) |

Atomic subtract one from the value at addr. Equal to rsAtomicSub(addr, 1)

Parameters:

  addr | Address of value to decrement

Returns:
  old value

int32_t rsAtomicInc | ( | volatile int32_t * | addr | ) |

Atomic add one to the value at addr. Equal to rsAtomicAdd(addr, 1)

Parameters:

  addr | Address of value to increment

Returns:
  old value

uint32_t rsAtomicInc | ( | volatile uint32_t * | addr | ) |

Atomic add one to the value at addr. Equal to rsAtomicAdd(addr, 1)

Parameters:

  addr | Address of value to increment

Returns:
  old value

uint32_t rsAtomicMax | ( | volatile uint32_t * | addr,
|  | uint32_t | value
| ) |  |

Atomic Set the value at addr to the max of addr and value addr[0] = rsMax(addr[0], value)

Parameters:

  addr | Address of value to modify
  value | comparison value

Returns:
  old value

int32_t rsAtomicMax | ( | volatile int32_t * | addr,
|  | int32_t | value
| ) |  |

Atomic Set the value at addr to the max of addr and value addr[0] = rsMin(addr[0], value)

Parameters:

  addr | Address of value to modify
  value | comparison value

Returns:
  old value

uint32_t rsAtomicMin | ( | volatile uint32_t * | addr,
|  | uint32_t | value
| ) |  |

Atomic Set the value at addr to the min of addr and value addr[0] = rsMin(addr[0], value)

Parameters:

  addr | Address of value to modify
  value | comparison value

Returns:
  old value

int32_t rsAtomicMin | ( | volatile int32_t * | addr,
|  | int32_t | value
| ) |  |

Atomic Set the value at addr to the min of addr and value addr[0] = rsMin(addr[0], value)

Parameters:

  addr | Address of value to modify
  value | comparison value

Returns:
  old value

int32_t rsAtomicOr | ( | volatile int32_t * | addr,
|  | int32_t | value
| ) |  |

Atomic Bitwise or a value from the value at addr. addr[0] |= value

Parameters:

  addr | Address of value to modify
  value | Amount to or with the value at addr

Returns:
  old value

uint32_t rsAtomicOr | ( | volatile uint32_t * | addr,
|  | uint32_t | value
| ) |  |

Atomic Bitwise or a value from the value at addr. addr[0] |= value

Parameters:

  addr | Address of value to modify
  value | Amount to or with the value at addr

Returns:
  old value

int32_t rsAtomicSub | ( | volatile int32_t * | addr,
|  | int32_t | value
| ) |  |

Atomic Subtract a value from the value at addr. addr[0] -= value

Parameters:

  addr | Address of value to modify
  value | Amount to subtract from the value at addr

Returns:
  old value

uint32_t rsAtomicSub | ( | volatile uint32_t * | addr,
|  | uint32_t | value
| ) |  |

Atomic Subtract a value from the value at addr. addr[0] -= value

Parameters:

  addr | Address of value to modify
  value | Amount to subtract from the value at addr

Returns:
  old value

uint32_t rsAtomicXor | ( | volatile uint32_t * | addr,
|  | uint32_t | value
| ) |  |

Atomic Bitwise xor a value from the value at addr. addr[0] ^= value

Parameters:

  addr | Address of value to modify
  value | Amount to xor with the value at addr

Returns:
  old value

int32_t rsAtomicXor | ( | volatile int32_t * | addr,
|  | int32_t | value
| ) |  |

Atomic Bitwise xor a value from the value at addr. addr[0] ^= value

Parameters:

  addr | Address of value to modify
  value | Amount to xor with the value at addr

Returns:
  old value