SetAccessRule() public method

public SetAccessRule ( EventWaitHandleAccessRule rule ) : void
rule EventWaitHandleAccessRule
return void
        public bool Flush(int timeout)
        {
            // Special case for timeout = 0; just send the request and immediately return.
            if (timeout == 0)
            {
                FlushImpl();
                return true;
            }

            // Create the wait handle with appropriate permissions.
            bool fCreatedNew;
            EventWaitHandleSecurity security = new EventWaitHandleSecurity();
            security.SetAccessRule(new EventWaitHandleAccessRule(new SecurityIdentifier(WellKnownSidType.ServiceSid, null), EventWaitHandleRights.Modify, AccessControlType.Allow));

            using (EventWaitHandle waitHandle = new EventWaitHandle(false, EventResetMode.ManualReset, TRACE_FLUSH_EVENT_NAME, out fCreatedNew, security))
            {
                // Request the trace service to flush data, and wait for the service to signal completion.
                FlushImpl();
                return waitHandle.WaitOne(timeout);
            }
        }