Home Units Hierarchy Routines All identifiers

Class unaRandomGenThread

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type unaRandomGenThread = class(unaThread)

Description

This thread produces random values from HPRC and other hard-predictable sources.

Hierarchy

Overview

Methods

Public constructor create(aheadGenSize: unsigned = 1000; active: bool = true; priority: int = THREAD_PRIORITY_LOWEST);
Public destructor Destroy(); override;
Public function feed(value: unsigned): bool;
Public function random(upperLimit: uint32 = $FFFFFFFF; maxTimeout: tTimeout = -1): uint32;
Protected function execute(globalId: unsigned): int; override;
Public procedure AfterConstruction(); override;
Public procedure BeforeDestruction(); override;
Protected procedure startIn(); override;
Protected procedure startOut(); override;

Properties

Public property pseudoFeeds: uint64 read f_pseudoFeeds;
Public property valuesReady: unsigned read getValuesInCacheNum;
Public property waitTime: uint64 read f_waitTime;
Public property waitTimeTotal: uint64 read f_waitTimeTotal;

Description

Methods

Public constructor create(aheadGenSize: unsigned = 1000; active: bool = true; priority: int = THREAD_PRIORITY_LOWEST);
 
Public destructor Destroy(); override;
 
Public function feed(value: unsigned): bool;

Feeds a generator with new randmon value. Does nothing if ahead gen size is already reached. Returns true if value was added, or false otherwise.

Public function random(upperLimit: uint32 = $FFFFFFFF; maxTimeout: tTimeout = -1): uint32;

Returns random value in range 0 to upperLimit - 1.

Parameters
upperLimit
Max value to be returned by function. Default is $FFFFFFFF.
maxTimeout
Time (ms) to wait for new value if none is ready. Default is -1, which equals 10 seconds.
Returns

Random value or high(unsigned) in case of some internal error or if timeout had occured and maxTimeout = -1 (default).

Protected function execute(globalId: unsigned): int; override;
 
Public procedure AfterConstruction(); override;
 
Public procedure BeforeDestruction(); override;
 
Protected procedure startIn(); override;
 
Protected procedure startOut(); override;
 

Properties

Public property pseudoFeeds: uint64 read f_pseudoFeeds;
 
Public property valuesReady: unsigned read getValuesInCacheNum;

Returns number of values in ahead-generated list.

Public property waitTime: uint64 read f_waitTime;
 
Public property waitTimeTotal: uint64 read f_waitTimeTotal;
 

(c) 2012 Lake of Soft


Generated by PasDoc 0.12.1 on 2012-10-09