Hi
I don't know what userspace routines do to hand time back to the system, though I guess that is the usleep.
However the realtime tasks will get run regardless.
As Andy said, the
usleep will give the CPU to other processes , so CPU time isn't wasted.
With the real-time scheduling kernel, a user-space program is not going to slow the system, the scheduler will always give priority to the real-time processes at the expense of user-space.
There is likely to be a quite finite amount your code can do at each poll, the example fetched 18 items of data and populated the 18 keys in the database.
So yes, if you want to complete each poll, it needs to be quite tight.
The alternative is the 'state' approach used a lot in real-time components, where each poll executes a stage and sets a flag as to which state it is at, for the next poll to pick up from.
This way you can achieve quite drawn out procedures (waiting for a signal etc) efficiently.
You can see the pure C code that comp saves you the trouble of writing, by running
comp redisclient.comp.
I haven't found any need to write a module from scratch in C yet. comp is much more convenient and productive.
Andy, please could you try to clarify the problems I might run into making gladeVCP controls for this if I code the hal module in C++?
Purely speculation, really, as all the code embedded in the GladeVCP widgets is Python.
It's a big bug bear of mine that everything is so heavily reliant upon python.
However it does not really matter how the pins and params are created, they will be able to be interfaced with gladeVCP or pyVCP.
So long as you don't mind making the UI in a python based system, your modules will work with it, whatever language they were written in.
regards