Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@

class SafeHandlesExample
{

static void Main()
{
UnmanagedMutex uMutex = new UnmanagedMutex("YourCompanyName_SafeHandlesExample_MUTEX");

try
{

uMutex.Create();
Console.WriteLine("Mutex created. Press Enter to release it.");
Console.ReadLine();
Expand Down Expand Up @@ -58,10 +56,8 @@ public UnmanagedMutex(string Name)

public void Create()
{
if (nameValue == null && nameValue.Length == 0)
{
throw new ArgumentNullException("nameValue");
}
if (nameValue == null || nameValue.Length == 0)
throw new ArgumentException(nameof(nameValue));

handleValue = CreateMutex(mutexAttrValue,
true, nameValue);
Expand Down Expand Up @@ -105,4 +101,4 @@ public void Release()
ReleaseMutex(handleValue);
}
}
//</Snippet1>
//</Snippet1>