public static void Two() { lock (_locker) { if (_currentMethod == 1) { _currentMethod = 2; Speak.SayTwo(); } } }
public static void Three() { lock (_locker) { if (_currentMethod == 2) { _currentMethod = 0; Speak.SayThree(); } } }
public static void One() { lock (_locker) { if (_currentMethod == 0) { _currentMethod = 1; Speak.SayOne(); } } }