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

◆ OpenExistingWorker()

static OpenExistingResult System.Threading.EventWaitHandle.OpenExistingWorker ( string name,
out EventWaitHandle result )
inlinestaticprivateinherited

Definition at line 76 of file EventWaitHandle.cs.

77 {
78 if (name == null)
79 {
80 throw new ArgumentNullException("name");
81 }
82 if (name.Length == 0)
83 {
84 throw new ArgumentException(SR.Argument_EmptyName, "name");
85 }
86 result = null;
87 SafeWaitHandle safeWaitHandle = Interop.Kernel32.OpenEvent(34603010u, inheritHandle: false, name);
88 if (safeWaitHandle.IsInvalid)
89 {
90 int lastPInvokeError = Marshal.GetLastPInvokeError();
91 switch (lastPInvokeError)
92 {
93 case 2:
94 case 123:
95 return OpenExistingResult.NameNotFound;
96 case 3:
97 return OpenExistingResult.PathNotFound;
98 case 6:
99 return OpenExistingResult.NameInvalid;
100 default:
101 throw Win32Marshal.GetExceptionForWin32Error(lastPInvokeError, name);
102 }
103 }
104 result = new EventWaitHandle(safeWaitHandle);
105 return OpenExistingResult.Success;
106 }
static SafeWaitHandle OpenEvent(uint desiredAccess, bool inheritHandle, string name)
static Exception GetExceptionForWin32Error(int errorCode, string path="")
EventWaitHandle(bool initialState, EventResetMode mode)

References System.Threading.EventWaitHandle.EventWaitHandle(), System.SR.Argument_EmptyName, System.IO.Win32Marshal.GetExceptionForWin32Error(), System.Runtime.InteropServices.Marshal.GetLastPInvokeError(), Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid.IsInvalid, and Interop.Kernel32.OpenEvent().

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