Ejemplo n.º 1
0
        private static OpenExistingResult OpenExistingWorker(string name, out Mutex?result)
        {
            OpenExistingResult status = WaitSubsystem.OpenNamedMutex(name, out SafeWaitHandle? safeWaitHandle);

            result = status == OpenExistingResult.Success ? new Mutex(safeWaitHandle !) : null;
            return(status);
        }
Ejemplo n.º 2
0
        private static OpenExistingResult OpenExistingWorker(string name, out Mutex?result)
        {
            ArgumentException.ThrowIfNullOrEmpty(name);

            OpenExistingResult status = WaitSubsystem.OpenNamedMutex(name, out SafeWaitHandle? safeWaitHandle);

            result = status == OpenExistingResult.Success ? new Mutex(safeWaitHandle !) : null;
            return(status);
        }
Ejemplo n.º 3
0
        private static OpenExistingResult OpenExistingWorker(string name, out Mutex?result)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            if (name.Length == 0)
            {
                throw new ArgumentException(SR.Argument_EmptyName, nameof(name));
            }

            OpenExistingResult status = WaitSubsystem.OpenNamedMutex(name, out SafeWaitHandle? safeWaitHandle);

            result = status == OpenExistingResult.Success ? new Mutex(safeWaitHandle !) : null;
            return(status);
        }