10-24-2014 03:50 AM
The parentheses in the subject are due to the fact that I'm not using the Structured Error Handler reference library, but have rolled my own to do something similar but in the manner I want it to. I don't actually use the SEH (haven't even got it installed at the moment on this PC) so am not sure exactly how it works under the hood.
I have a reasonably large application with a number of distinct parallel modules (GUI, state module, communication, motion control). The final parallel module is an error handling module. This consists of two queues - one for incoming errors, and one for outgoing actions. Errors are dequeued and their codes checked for their category (critical, warning, ignore or unclassified, for instance) and the appropriate category is returned to a local error handler via the action queue. When an error is passed to a local error handler VI, it enqueues the error to the main handler and waits for a response to that particular error.
This all works nicely, in much the same way the SEH would do. However, with either the SEH or my local error handler method, I find myself wondering how often to place these down and the consequences of doing so. If they're non-reentrant, I imagine I may end up with lots of parallel processes sitting patiently to access the VI as it's blocked by another, causing jitter. If I go pre-allocated clone, I could potentially have many many callers using this function, which strikes me as a bit of a waste of resources. My gut feel is to go with shared-allocation clones, as the vast majority of the time it'll be no error passed through an empty case, and not to place them in absolutely every subVI - just perhaps after a state executes in the state handler, in all the parallel loops of the submodules etc.
Just wondering what anyone else does with their error handling solution, and whether my thoughts make sense.
10-24-2014 04:16 AM
Hi,
as always with this kind of problem it depends on the needs of your application.
If the execution time of the non-reentrant is small enough, maybe the resulting jitter is neglible. How critical is it to your app?
If the resources demands of the pre-allocated clones are small enough, maybe it is worth wasting these resources most of the time to minimize delays?
Maybe your gut feeling about your app is right and shared clones have just the right balance for you.
Your thoughts make sense, just adding some of my own.
Best regards
Florian
10-24-2014 04:33 AM
Having chatted to my friendly neighbourhood Spiderman Architect, he suggested I should probably just stop being a wimp and just use pre-allocated clones to avoid the jitter and to stop worrying about the resource hit, as you suggest 🙂
I'll use the same code on both PC host and RT host, hence the jitter concerns on the RT.
Thanks for the thoughts!
10-27-2014 04:50 AM
Hi Thoult,
It seems that if you use the pre-allocated clones, for every call a data space would have been created. This would would avoid jitter as you correctly mentioned. Do let us know if using these solves the issue you are experiencing.
Thanks,
Shazil M.
Applications Engineer
National Instruments UK & Ireland.