CUDA_Manager.Form1.IsSingleInstance C# (CSharp) Method

IsSingleInstance() static private method

static private IsSingleInstance ( ) : bool
return bool
        static bool IsSingleInstance()
        {
            try
            {
                // Try to open existing mutex.
                Mutex.OpenExisting(minepath.Replace(Path.DirectorySeparatorChar, '_'));
            }
            catch
            {
                // If exception occurred, there is no such mutex.
                _m = new Mutex(true, minepath.Replace(Path.DirectorySeparatorChar, '_'));

                // Only one instance.
                return true;
            }
            // More than one instance.
            return false;
        }