Qore Programming Language Reference Manual 0.8.8

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Functions Variables Groups Pages
Public Member Functions | List of all members
Qore::Thread::Sequence Class Reference

The Sequence class implements a thread-safe increment-only object. More...

## Public Member Functions
| constructor ()
| Creates a new Sequence object. More...
| constructor (softint start)
| Creates a new Sequence object with a starting value. More...
| copy ()
| Creates a new Sequence object, not based on the original. More...
int | getCurrent ()
| Returns the current value of the sequence. More...
int | next ()
| Atomically increments the sequence value and returns the last value. More...

## Detailed Description

The Sequence class implements a thread-safe increment-only object.

This class does not block therefore is not tagged with Qore::PO_NO_THREAD_CLASSES

## Member Function Documentation

Qore::Thread::Sequence::constructor | ( |  | ) |

Creates a new Sequence object.

Example:
  my Sequence $seq();

Qore::Thread::Sequence::constructor | ( | softint | start | ) |

Creates a new Sequence object with a starting value.

Example:
  my Sequence $seq(20);

Qore::Thread::Sequence::copy | ( |  | ) |

Creates a new Sequence object, not based on the original.

Example:
  my Sequence $s2 = $seq.copy();

int Qore::Thread::Sequence::getCurrent | ( |  | ) |

Returns the current value of the sequence.

Returns
  current value of the sequence

Code Flags:
  CONSTANT

Example:
  my int $v = $seq.getCurrent();

int Qore::Thread::Sequence::next | ( |  | ) |

Atomically increments the sequence value and returns the last value.

Returns
  the last value of the sequence

Example:
  my int $next = $seq.next();