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

◆ EnsureInitialized() [3/3]

static void Interop.Winsock.EnsureInitialized ( )
inlinestaticpackage

Definition at line 337 of file Interop.cs.

338 {
339 if (s_initialized == 0)
340 {
341 Initialize();
342 }
343 unsafe static void Initialize()
344 {
345 Unsafe.SkipInit(out WSAData wSAData);
346 SocketError socketError = WSAStartup(514, &wSAData);
347 if (socketError != 0)
348 {
349 throw new SocketException((int)socketError);
350 }
351 if (Interlocked.CompareExchange(ref s_initialized, 1, 0) != 0)
352 {
353 socketError = WSACleanup();
354 }
355 }
356 }
static SocketError WSACleanup()
static int s_initialized
Definition Interop.cs:67
static unsafe SocketError WSAStartup(short wVersionRequested, WSAData *lpWSAData)
static int CompareExchange(ref int location1, int value, int comparand)

References System.Threading.Interlocked.CompareExchange(), Interop.Winsock.s_initialized, Interop.Winsock.WSACleanup(), and Interop.Winsock.WSAStartup().