This class is only available in the RT environment. It has been derived from CIThread to ease the creation of a thread that has to execute regularly; the poll period is expressed in milliseconds (internally the value is rounded to the next multiple of 10 milliseconds) and the wait period starts each time when the thread exits OnPoll. The class must be used to derive an application specific poll thread class, or it can be used directly to control a thread object.
Constructor
Destructor
Create
DoForever
OnPoll
SetPoll
The following member variable are only available to the members of the class and its derived classes:
DWORD m_dwMsecs;
See CIThread::Constructor.
See CIThread::Destructor.
If the object is already attached, it is first detached. Then this call creates a new RT thread object and attaches it to the object.
DWORD CIPollThread::Create(char * pszName, DWORD dwTime,
BYTE byPrio, DWORD dwStack, BOOLEAN bGo);
pszName Specifies a name that, if not empty, is used to catalog the RT object.
dwTime Iindicates the number of milliseconds per poll period (this may be rounded to a multiple of 10 msec).
byPrio Indicates the priority for the new thread and must either be zero (this means the best possible priority in the process) or obey this rule: (max priority of process) <= byPrio < 254.
dwStack Indicates the number of bytes to be reserved for stack space; it should be a multiple of 4 and at least 2048; if omitted, 4096 is used.
bGo Iindicates whether the thread will execute immediately (TRUE) or will be created in suspended state (FALSE); if omitted, TRUE is used. The result is a status indicating success or failure:
E_OK
E_MEM
E_LIMIT
E_SLOT
E_PARAM
dwStack
contains a value of less than 2048, or the name is too long or is improperly formatted.
E_CONTEXT
See CIThread::DoForever. CIPollThread::DoForever is called by the framework and should never be called explicitly. CIPollThread::DoForever waits for one period, calls the OnPoll member and returns its result. When overruling this call, do not include a call to the default call.
CIPollThread::OnPoll is called by the framework when a period has passed; it should never be called explicitly. CIPollThread::OnPoll just returns TRUE. When overruling this call, there is no need to call the default call.
BOOLEAN CIPollThread::OnPoll(void);
None. The result must be TRUE to let the thread continue, FALSE to terminate the thread.
With this call the poll period can be changed. The new value becomes active in the next period.
void CIPollThread::SetPoll(DWORD dwTime);
dwTime Iindicates the number of milliseconds per poll period (This value may be rounded up to a multiple of 10 msec).