Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ OpenExistingWorker()

static OpenExistingResult System.Threading.Semaphore.OpenExistingWorker ( string name,
out Semaphore result )
inlinestaticprivate

Definition at line 92 of file Semaphore.cs.

93 {
94 if (name == null)
95 {
96 throw new ArgumentNullException("name");
97 }
98 if (name.Length == 0)
99 {
100 throw new ArgumentException(SR.Argument_EmptyName, "name");
101 }
102 SafeWaitHandle safeWaitHandle = Interop.Kernel32.OpenSemaphore(34603010u, inheritHandle: false, name);
103 if (safeWaitHandle.IsInvalid)
104 {
105 result = null;
107 {
108 case 2:
109 case 123:
110 return OpenExistingResult.NameNotFound;
111 case 3:
112 return OpenExistingResult.PathNotFound;
113 case 6:
114 return OpenExistingResult.NameInvalid;
115 default:
117 }
118 }
119 result = new Semaphore(safeWaitHandle);
120 return OpenExistingResult.Success;
121 }
static SafeWaitHandle OpenSemaphore(uint desiredAccess, bool inheritHandle, string name)
static Exception GetExceptionForLastWin32Error(string path="")
Semaphore(int initialCount, int maximumCount)
Definition Semaphore.cs:11

References System.Threading.Semaphore.Semaphore(), System.SR.Argument_EmptyName, System.IO.Win32Marshal.GetExceptionForLastWin32Error(), System.Runtime.InteropServices.Marshal.GetLastPInvokeError(), Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid.IsInvalid, and Interop.Kernel32.OpenSemaphore().

Referenced by System.Threading.Semaphore.OpenExisting(), and System.Threading.Semaphore.TryOpenExisting().