Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
XamarinのMutexサンプル
using System;
using System.Threading;
namespace Sample
{
public class SampleClass
{
private Mutex mMutex = new Mutex();
void methodA(){
mMutex.WaitOne();
Console.WriteLine("methodA 1");
Thread.Sleep(10);
Console.WriteLine("methodA 2");
mMutex.ReleaseMutex();
}
void methodB(){
mMutex.WaitOne();
Console.WriteLine("methodB 1");
Thread.Sleep(5);
Console.WriteLine("methodB 2");
mMutex.ReleaseMutex();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment