rasProject_01 / weSweetHome
R. 240
process control / RasPi software by weinert-automation
|
Cyclic or event driven task / threads structure. More...
#include <weUtil.h>
Data Fields | |
union { | |
cycTaskEventData_t cycTaskEventData | |
< allow different event data for cyclic and other event types More... | |
}; | |
Event data for cyclic and other event types. More... | |
pthread_cond_t | cond |
the event occurred condition | |
uint32_t | count |
the event counter (modified by manager, only) | |
timespec | stamp |
absolute / monotonic event stamp (dto.) | |
Cyclic or event driven task / threads structure.
This structure supports the organisation of tasks respectively threads to work all on a same event type. One common case is the event being a next time interval, like the next 100ms entered, and, as thread e.g., the process control tasks to work on the 100ms cycle.
Such approach involves two types of threads:
One controller/manager determining the event, recording it by increasing the event counter and signalling all worker threads.
Zero to some worker threads doing work on every or every other etc. event, usually by holding and updating an event counter value at which to do the work.
The main purpose are absolute time driven cyclic tasks as usual in industrial PLCs.
For the standard cycles provided here, 1ms, 10ms .. 100ms, 1s the handler thread is provided as singleton doing other time and date related jobs for all; see theCyclistStart(), theCyclistWaitEnd() and endCyclist().
See cyc1ms, cyc10ms, cyc20ms, cyc100ms, cyc1sec
See also have1msCyc, have10msCyc ... have1secCyc
cycTaskEventData_t cycTaskEventData |
< allow different event data for cyclic and other event types
cyclic event data
union { ... } @14 |
Event data for cyclic and other event types.
This union allows for different event data types for different types of events like cyclic ticks, or any other event types.
Anyway the information must be copied by the event controller / manager under mutex lock to the event handler's (i.e. this) task structure.