At the moment, I have some functions which look like this:
private bool inFunction1 = false;
public void function1()
{
if (inFunction1) return;
inFunctio
You may want to consider avoiding re-entrancy by modifying your design so that it will never call function1() before its previous invocation completes. To me it seems that a layer is missing from above function1().
I dont think that will be possible.
The closest will be the the 'Synchronized' attribute, but that will block all subsequent calls.
You may find that you could use PostSharp to accomplish this - along with the suggestions from Anthony about using try/finally. It's likely to be messy though. Also consider whether you want the re-entrancy to be on a per-thread or per-instance basis. (Could multiple threads call into the method to start with, or not?)
There's nothing like this in the framework itself.