Difference between revisions of "TSocketTimer"

From Ultibo.org
Jump to: navigation, search
(Created page with "Return to Unit Protocol __TOC__ === Description === ---- ''To be documented'' === Class definitions === ---- <div class="toccolours mw-collapsible mw-...")
 
(No difference)

Latest revision as of 04:48, 25 May 2018

Return to Unit Protocol


Description


To be documented

Class definitions



TSocketTimer = class(TObject)

constructor Create(AProtocol:TNetworkProtocol);  
destructor Destroy; override;  
protected
FProtocol:TNetworkProtocol;  
 
FLock:TMutexHandle;  
FInterval:LongWord;  
FCheckTimer:TTimerHandle;  
FProcessSemaphore:TSemaphoreHandle;  
 
FCount:LongWord;  
FMaxCount:LongWord;  
 
FFirst:PSocketTimerItem;  
FLast:PSocketTimerItem;  
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  
 
function Dequeue(AMax:Integer):TProtocolSocket;  
 
function FirstKey:Integer;  
function InsertKey(ASocket:TProtocolSocket; AItem:PSocketTimerItem; AKey:Integer):Boolean;  
function DeleteKey(ASocket:TProtocolSocket; AItem:PSocketTimerItem):Boolean;  
function DecrementKey:Integer;  
public
property Count:LongWord read FCount;  
property MaxCount:LongWord read FMaxCount;  
 
function StartTimer(AInterval:LongWord):Boolean; virtual;  
function StopTimer:Boolean; virtual;  
 
function CheckTimer:Boolean; virtual;  
function ProcessTimer:Boolean; virtual;  
 
function ScheduleSocket(ASocket:TProtocolSocket; ATimeout:LongWord):Boolean; virtual;  
function UnscheduleSocket(ASocket:TProtocolSocket):Boolean; virtual;  
 
function ScheduleSocketItem(ASocket:TProtocolSocket; AItem:PSocketTimerItem; ATimeout:LongWord):Boolean; virtual;  
function UnscheduleSocketItem(ASocket:TProtocolSocket; AItem:PSocketTimerItem):Boolean; virtual;  


Function declarations



constructor TSocketTimer.Create(AProtocol:TNetworkProtocol);
Description: To be documented
Note None documented


destructor TSocketTimer.Destroy;
Description: To be documented
Note None documented


function TSocketTimer.AcquireLock:Boolean;
Description: To be documented
Note None documented


function TSocketTimer.ReleaseLock:Boolean;
Description: To be documented
Note None documented


function TSocketTimer.Dequeue(AMax:Integer):TProtocolSocket;
Description: Get and remove the first socket from the timer list if the key is less than or equal to Max
Max The maximum value of the key for the page to be dequeued
Return Dequeued Socket or nil on failure


function TSocketTimer.FirstKey:Integer;
Description: Get the first Key value from the timer list
Return First Key value from timer list or SOCKET_TIMER_KEY_NONE on failure


function TSocketTimer.InsertKey(ASocket:TProtocolSocket; AItem:PSocketTimerItem; AKey:Integer):Boolean;
Description: Insert the supplied socket in the timer list in delta ascending order based on Key
Socket The socket to be inserted
Item Pointer to the socket timer item to insert (Pass nil to allocate dynamically)
Key The key to order the insertion on
Return True if completed or False on failure


function TSocketTimer.DeleteKey(ASocket:TProtocolSocket; AItem:PSocketTimerItem):Boolean;
Description: Delete the supplied socket from the timer list
Socket The socket to be deleted
Item Pointer to the socket timer item to be deleted (Pass nil if item was dynamically allocated)
Return True if completed or False on failure


function TSocketTimer.DecrementKey:Integer;
Description: Decrement the first Key value in the Timer list
Return First Key value in timer list after decrement or SOCKET_TIMER_KEY_NONE on failure


function TSocketTimer.StartTimer(AInterval:LongWord):Boolean;
Description: To be documented
Note None documented


function TSocketTimer.StopTimer:Boolean;
Description: To be documented
Note None documented


function TSocketTimer.CheckTimer:Boolean;
Description: To be documented
Note None documented


function TSocketTimer.ProcessTimer:Boolean;
Description: To be documented
Note None documented


function TSocketTimer.ScheduleSocket(ASocket:TProtocolSocket; ATimeout:LongWord):Boolean;
Description: To be documented
Note None documented


function TSocketTimer.UnscheduleSocket(ASocket:TProtocolSocket):Boolean;
Description: To be documented
Note None documented


function TSocketTimer.ScheduleSocketItem(ASocket:TProtocolSocket; AItem:PSocketTimerItem; ATimeout:LongWord):Boolean;
Description: To be documented
Note None documented


function TSocketTimer.UnscheduleSocketItem(ASocket:TProtocolSocket; AItem:PSocketTimerItem):Boolean;
Description: To be documented
Note None documented


Return to Unit Reference