INtime SDK Help
cillpollthread

CILLPollThread

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, using a low level alarm; the period runs independent of the thread. The class must be used to derive an application specific low level poll thread class, or it can be used directly to control a thread object.

Class members

Constructor

Destructor

Create

DoForever

OnPoll

SetPoll

Member variables

The following member variables are only available to the members of the class and its derived classes:

DWORD m_dwUsecs; KNHANDLE m_hAlarm; DWORD m_dwAlarm[KN_ALARM_EVENT_SIZE/4]; BOOLEAN m_bChanged;

CILLPollThread::Constructor

See CIThread::Constructor.

CILLPollThread::Destructor

See CIThread::Destructor. The destructor deletes the alarm, if it had been created already.

CILLPollThread::Create

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.

Syntax

DWORD CILLPollThread::Create(
    char * pszName, 
    DWORD dwUsecs,
    BYTE byPrio, 
    DWORD dwStack, 
    BOOLEAN bGo
);

Parameters

pszName
Specifies a name that, if not empty, is used to catalog the RT object.
dwUsecs
Indicates the number of usecs per poll period.
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
Indicates whether the thread will execute immediately (TRUE) or will be created in suspended state (FALSE); if omitted, TRUE is used. The new thread creates the low level alarm object. The result is a status indicating success or failure.

Status

E_OK
No exceptional conditions occurred.
E_MEM
The current process cannot create a thread as specified with the memory available.
E_LIMIT
Either the calling thread's process already reached its object or thread limit, or the job does not allow the required priority, or the object directory is full.
E_SLOT
You cannot create more RT objects because the GDT's slots are full.
E_PARAM
dwStack contains a value of less than 2048, or the name is too long or is improperly formatted.
E_CONTEXT
The object directory already contains the name being cataloged.

CILLPollThread::DoForever

See CIThread::DoForever. CILLPollThread::DoForever is called by the framework and should never be called explicitly. CILLPollThread::DoForever waits for the alarm event, calls the OnPoll member and returns its result. When overruling this call, do not include a call to the default call.

CILLPollThread::OnPoll

CILLPollThread::OnPoll is called by the framework when a period has passed; it should never be called explicitly. CILLPollThread::OnPoll just returns TRUE. When overruling this call, there is no need to call the default call.

Syntax

BOOLEAN CILLPollThread::OnPoll(void);

Parameters

None. The result must be TRUE to let the thread continue, FALSE to terminate the thread.

CILLPollThread::SetPoll

With this call the poll period can be changed. The new value becomes active in the next period.

Syntax

void CILLPollThread::SetPoll(
    DWORD dwUsecs
);

Parameters

dwUsecs
Indicates the number of usecs per poll period.
See Also

Alarms