Esempio n. 1
0
 private NamedSemaphore(string name, Native.OpenFlags openFlags)
 {
     semaphoreHandle = Native.SemaphoreOpen(
         name,
         openFlags,
         Native.ModeFlags.S_IRUSR | Native.ModeFlags.S_IWUSR,
         0);
 }
Esempio n. 2
0
        private NamedSemaphore(string name, Native.OpenFlags openFlags)
        {
            semaphoreHandle = Native.SemaphoreOpen(
                name,
                openFlags,
                Native.ModeFlags.S_IRUSR | Native.ModeFlags.S_IWUSR,
                0);

            if (semaphoreHandle.IsInvalid)
            {
                throw new IOException(
                          $"Failed to create a NamedSemaphore {name}",
                          innerException: new Win32Exception(Marshal.GetLastWin32Error()));
            }

            semaphoreName = name;
        }