morpheus.utils.atomic_integer.AtomicInteger

(Latest Version)
class AtomicInteger(value=0)[source]

Bases: object

Simple atomic integer from https://stackoverflow.com/a/48433648/634820

Parameters
_valueint

Initial value, defaults to 0.

Attributes
value

Get value.

Methods

dec([d])

Decrements and returns new value.

get_and_inc([d])

Gets the current value, returns it, and increments.

inc([d])

Increments and returns new value.

dec(d=1)[source]

Decrements and returns new value.

Parameters
dint, optional

Value to decrement by, default 1.

Returns
int

Decremented value.

get_and_inc(d=1)[source]

Gets the current value, returns it, and increments. Different from inc() which increments, then returns.

Parameters
dint, optional

How much to increment, by default 1.

Returns
int

Incremented value.

inc(d=1)[source]

Increments and returns new value.

Parameters
dint, optional

Value to increment by, default 1.

Returns
int

Incremented value.

property value

Get value.

Returns
int

Current value.

© Copyright 2023, NVIDIA. Last updated on Apr 11, 2023.