At the moment, I have some functions which look like this:
private bool inFunction1 = false;
public void function1()
{
if (inFunction1) return;
inFunction1 = true;
// do stuff which might cause function1 to get called
...
inFunction1 = false;
}
I'd like to be able to declare them like this:
[NoReEntry]
public void function1()
{
// do stuff which might cause function1 to get called
...
}
Is there an attribute I can add to a function to prevent reentry? If not, how would I go about making one? I've heard about AOP attributes that can be used to add code before and after function calls; would they be suitable?