private bool TryCreateEvent(string name, out EventWaitHandle ev) { _logger.WriteLine("Creating event {0}", name); EventWaitHandleSecurity security = CreateSecurity(EventWaitHandleRights.FullControl); ev = new EventWaitHandle(false, EventResetMode.AutoReset, name, out bool createdNew, security); _logger.WriteLine( "Created event {0} with handle {1} with security {2}, new {3}", name, ev.SafeWaitHandle.DangerousGetHandle(), (security != null ? security.GetSecurityDescriptorSddlForm(AccessControlSections.All) : "none"), createdNew); return(createdNew); }