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

◆ GetOrAllocateThreadPoolBoundHandle()

ThreadPoolBoundHandle System.Net.Sockets.SafeSocketHandle.GetOrAllocateThreadPoolBoundHandle ( bool trySkipCompletionPortOnSuccess)
inlinepackage

Definition at line 143 of file SafeSocketHandle.cs.

144 {
145 if (_released)
146 {
148 }
149 if (_iocpBoundHandle != null)
150 {
151 return _iocpBoundHandle;
152 }
153 lock (this)
154 {
155 ThreadPoolBoundHandle threadPoolBoundHandle = _iocpBoundHandle;
156 if (threadPoolBoundHandle == null)
157 {
158 if (System.Net.NetEventSource.Log.IsEnabled())
159 {
160 System.Net.NetEventSource.Info(this, "calling ThreadPool.BindHandle()", "GetOrAllocateThreadPoolBoundHandle");
161 }
162 try
163 {
164 threadPoolBoundHandle = ThreadPoolBoundHandle.BindHandle(this);
165 }
166 catch (Exception ex) when (!ExceptionCheck.IsFatal(ex))
167 {
168 bool isClosed = base.IsClosed;
169 bool flag = !IsInvalid && !base.IsClosed && ex is ArgumentException;
170 CloseAsIs(abortive: false);
171 if (isClosed)
172 {
174 }
175 if (flag)
176 {
178 }
179 throw;
180 }
181 if (trySkipCompletionPortOnSuccess && CompletionPortHelper.SkipCompletionPortOnSuccess(threadPoolBoundHandle.Handle))
182 {
184 }
185 Volatile.Write(ref _iocpBoundHandle, threadPoolBoundHandle);
186 }
187 return threadPoolBoundHandle;
188 }
189 }
static readonly System.Net.NetEventSource Log
static void Info(object thisOrContextObject, FormattableString formattableString=null, [CallerMemberName] string memberName=null)
static void ThrowSocketDisposedException(Exception innerException=null)
static string net_sockets_asyncoperations_notallowed
Definition SR.cs:116
Definition SR.cs:7
static ThreadPoolBoundHandle BindHandle(SafeHandle handle)
static void Write(ref bool location, bool value)
Definition Volatile.cs:74

References System.Net.Sockets.SafeSocketHandle._iocpBoundHandle, System.Net.Sockets.SafeSocketHandle._released, System.Net.Sockets.SafeSocketHandle._skipCompletionPortOnSuccess, System.Threading.ThreadPoolBoundHandle.BindHandle(), System.Net.Sockets.SafeSocketHandle.CloseAsIs(), System.Threading.ThreadPoolBoundHandle.Handle, System.Net.NetEventSource.Info(), System.Net.ExceptionCheck.IsFatal(), System.Net.Sockets.SafeSocketHandle.IsInvalid, System.Net.NetEventSource.Log, System.SR.net_sockets_asyncoperations_notallowed, System.Net.Sockets.CompletionPortHelper.SkipCompletionPortOnSuccess(), System.Net.Sockets.SafeSocketHandle.ThrowSocketDisposedException(), and System.Threading.Volatile.Write().

Referenced by System.Net.Sockets.Socket.GetOrAllocateThreadPoolBoundHandleSlow().