I have almost finishing implementing in my program something more or less general that allows any kind thing (code or data) to change through time according to user specified intervals and intervalsets (sets of subsequent intervals). As allways, rather than going for the easy way I want to tweak it and make the design the more efficient possible:) Currently I'm undecided between the following 3 ways and have one important doubt in 1:
1- Having the timer.device send messages when the beggining of next interval is reached to the process that handles the object, the messages being handled by an Exec exception. This is my favourite but I'm having a problem with it: I've read that Exec disables signals while processing exceptions, so what will happend if another signal is received (e.g. signaling the end of another objects current interval) while the exception is being processed, will exec process it after ?
2- Same as above but through a software interrupt, although here all other processes will be interrupted to process it so probably not as good.
3- Screw it, it's not that much big overhead in general except when time intervals are very short so check to see if current interval time has already passed each time the corresponding object is used, while in previous implementations it would only need to copy a pointer to the object before starting to use it. Not so efficient of course, cause it's done each time the object is used but less implementation headaches.
What do you guys think ?
:pint: