While implementing the callback functionality I bumped into the following problems.
What is a good way to deal with the situation when an ill-behaving callee doesn't return? How can I detect this situation and continue my regular program flow?
My only idea until now is to create a thread which does the actual callback and kill it (and the application) after some timeout.
The second point is that i don't want to give the callee the possibility to mess around with my stack. How can I provide a clean stack for the callee and that with keeping in mind that eventually several callbacks could happen at the same time?
My solution until now is the following approach. Every time when an application installs a callback procedure it has to allocate some memory for stack usage and provide a pointer to it.
I will appreciate your constructive comments and proposals.