System.Security.AccessControl.SemaphoreSecurity.AddAccessRule C# (CSharp) Méthode

AddAccessRule() public méthode

public AddAccessRule ( SemaphoreAccessRule rule ) : void
rule SemaphoreAccessRule
Résultat void
        public void AddAccessRule(SemaphoreAccessRule rule)
        {
            base.AddAccessRule(rule);
        }

Same methods

SemaphoreSecurity::AddAccessRule ( System rule ) : void

Usage Example

        public GlobalReaderWriterLock(string nameOfThisLock)
        {
            _hatName = nameOfThisLock;

            // we need to make two native sync objects, a mutex and a semaphore
            // that are global so every process and user on the system can share them as long as they agree on the lock's name
            string mutexId = string.Format("Global\\Mut_{0}", _hatName);
            string semaphoreId = string.Format("Global\\Sem_{0}", _hatName);
            bool iDontCareWhetherItsNew;
            {
                MutexAccessRule allowEveryoneRule = new MutexAccessRule(new SecurityIdentifier(WellKnownSidType.WorldSid, null), MutexRights.FullControl, AccessControlType.Allow);
                MutexSecurity securitySettings = new MutexSecurity();
                securitySettings.AddAccessRule(allowEveryoneRule);

                _holdTheHat = new Mutex(false, mutexId, out iDontCareWhetherItsNew, securitySettings);
            }
            {
                SemaphoreAccessRule allowEveryoneRule = new SemaphoreAccessRule(new SecurityIdentifier(WellKnownSidType.WorldSid, null), SemaphoreRights.FullControl, AccessControlType.Allow);
                SemaphoreSecurity securitySettings = new SemaphoreSecurity();
                securitySettings.AddAccessRule(allowEveryoneRule);

                _chipsInTheHat = new Semaphore(READER_CHIPS, READER_CHIPS, semaphoreId, out iDontCareWhetherItsNew, securitySettings);
            }
        }
All Usage Examples Of System.Security.AccessControl.SemaphoreSecurity::AddAccessRule