<p>At the moment, I have some functions which look like this:</p>

<pre><code>private bool inFunction1 = false;
public void function1()
{
    if (inFunction1) return;
    inFunction1 = true;

    // do stuff which might cause function1 to get called
    ...

    inFunction1 = false;
}
</code></pre>

<p>I'd like to be able to declare them like this:</p>

<pre><code>[NoReEntry]
public void function1()
{
    // do stuff which might cause function1 to get called
    ...
}
</code></pre>

<p>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?</p>

There is no such attribute predefined. You can make new attributes, but that won't help you. The issue is making the custom attribute prevent the method being called again, which I don't think is doable.
The lock statement is not what you want, since that will cause calls to block and wait, not return immediately.
PS: use a try ... finally block in the above sample. Otherwise, if an exception is thrown in the middle of the function, inFunction1 will be left true and all calls will return immediately.
e.g. :
```
```
if (inFunction1) 
   return;

try
{
  inFunction1 = true;

  // do stuff which might cause function1 to get called
  ...
}
finally 
{
  inFunction1 = false;
}
```
```