Determining if current thread is executing
You need to look at how you can make the Execute method both thread-safe and true to the requirements of the method. You say that it only should return true in the case where the delegate is actually called, but you need to make sure that only one thread can call it at a time. That's where lock comes in. You could potentially do something like:

public class SingleCallAction
{
  private readonly object sync = new object();
  private readonly Action action;
  private bool executed;

  public SingleCallAction(Action action)
  {
    if (action == null)
      throw new ArgumentNullException("action");

    this.action = action;
  }

  public bool Execute()
  {
    if (!executed)
    {
      lock(sync)
      {
        if (!executed)
        {
          action();
          executed = true;
          return true;
        }
      }
    }

    return false;
  }
}


Now, what this class provides is a wrapper around an Action delegate. We use Action because it supports both delegate assignment, or lambda assignment.

The Execute method will first check to see if it has previously been executed (if it has, it will jump down to the return false; as its not the thread that has executed the delegate.

If if hasn't executed, it will lock the sync object to prevent any other threads from executing the inner code block. The compiler is generating Monitor.Enter and Monitor.Exit calls here for you, worth a read up!

After the lock, we check whether the executed flag is set again. This allows us to prevent race conditions for competing threads. Don't worry about race conditions when dealing with the executed flag, as variable reads/writes are always atomic operations (mostly).

If we are the first thread to be executing the delegate, we can then execute it action(), set the flag as executed, and return true.

Any subsequent calls will always result in false.

To use in code:

var action = new SingleCallAction(() =&gt; Console.WriteLine("Executed"));

var thread1 = new Thread(() =&gt; Console.WriteLine(action.Execute()));
var thread2 = new Thread(() =&gt; Console.WriteLine(action.Execute()));

thread1.Start();
thread2.Start();


Should result in:

Executed
True
False