<p>I have a situation where I might have multiple instances of a program running at once, and it's important that just one specific function not be executing in more than one of these instances at once.</p>

<p>Is this the proper way to use a mutex to prevent this from happening?</p>

<pre><code>lock (this.GetType()) {
    _log.Info("Doing Sync");
    DoSync();
    _log.Info("Sync Completed");
}
</code></pre>

TheSeeker is correct.
Jeff Richter's advice in
Clr Via C#
(p638-9) on locking is to create a private object specifically for the purpose of being locked.
```
```
private Object _lock = new Object();

// usage
lock( _lock )
{
    // thread-safe code here..
}
```
```
This works because _lock cannot be locked by anything outside the current class.
EDIT: this is applicable to threads executing within a single process. @David Mohundro's answer is correct for inter-process locking.