using System; using System.Runtime.CompilerServices; using System.Runtime.ConstrainedExecution; using System.Runtime.InteropServices; namespace System.Threading { /// A synchronization primitive that can also be used for interprocess synchronization. /// 1 // Token: 0x02000616 RID: 1558 [ComVisible(true)] public sealed class Mutex : WaitHandle { /// Initializes a new instance of the class with default properties. // Token: 0x060038EA RID: 14570 RVA: 0x000C475C File Offset: 0x000C295C [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] public Mutex() { bool flag; this.Handle = Mutex.CreateMutex_internal(false, null, out flag); } /// Initializes a new instance of the class with a Boolean value that indicates whether the calling thread should have initial ownership of the mutex. /// true to give the calling thread initial ownership of the mutex; otherwise, false. // Token: 0x060038EB RID: 14571 RVA: 0x000C4780 File Offset: 0x000C2980 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] public Mutex(bool initiallyOwned) { bool flag; this.Handle = Mutex.CreateMutex_internal(initiallyOwned, null, out flag); } /// Initializes a new instance of the class with a Boolean value that indicates whether the calling thread should have initial ownership of the mutex, and a string that is the name of the mutex. /// true to give the calling thread initial ownership of the named system mutex if the named system mutex is created as a result of this call; otherwise, false. /// The name of the . If the value is null, the is unnamed. /// The named mutex exists and has access control security, but the user does not have . /// A Win32 error occurred. /// The named mutex cannot be created, perhaps because a wait handle of a different type has the same name. /// /// is longer than 260 characters. // Token: 0x060038EC RID: 14572 RVA: 0x000C47A4 File Offset: 0x000C29A4 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] public Mutex(bool initiallyOwned, string name) { bool flag; this.Handle = Mutex.CreateMutex_internal(initiallyOwned, name, out flag); } /// Initializes a new instance of the class with a Boolean value that indicates whether the calling thread should have initial ownership of the mutex, a string that is the name of the mutex, and a Boolean value that, when the method returns, indicates whether the calling thread was granted initial ownership of the mutex. /// true to give the calling thread initial ownership of the named system mutex if the named system mutex is created as a result of this call; otherwise, false. /// The name of the . If the value is null, the is unnamed. /// When this method returns, contains a Boolean that is true if a local mutex was created (that is, if is null or an empty string) or if the specified named system mutex was created; false if the specified named system mutex already existed. This parameter is passed uninitialized. /// The named mutex exists and has access control security, but the user does not have . /// A Win32 error occurred. /// The named mutex cannot be created, perhaps because a wait handle of a different type has the same name. /// /// is longer than 260 characters. // Token: 0x060038ED RID: 14573 RVA: 0x000C47C8 File Offset: 0x000C29C8 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] public Mutex(bool initiallyOwned, string name, out bool createdNew) { this.Handle = Mutex.CreateMutex_internal(initiallyOwned, name, out createdNew); } // Token: 0x060038EE RID: 14574 [MethodImpl(MethodImplOptions.InternalCall)] private static extern IntPtr CreateMutex_internal(bool initiallyOwned, string name, out bool created); // Token: 0x060038EF RID: 14575 [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool ReleaseMutex_internal(IntPtr handle); /// Releases the once. /// The calling thread does not own the mutex. /// 1 // Token: 0x060038F0 RID: 14576 RVA: 0x000C47E0 File Offset: 0x000C29E0 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] public void ReleaseMutex() { if (!Mutex.ReleaseMutex_internal(this.Handle)) { throw new ApplicationException("Mutex is not owned"); } } } }