MCPcopy Create free account
hub / github.com/abbeycode/UnrarKit / ShutdownCheckAnother

Function ShutdownCheckAnother

Libraries/unrar/system.cpp:128–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126
127
128bool ShutdownCheckAnother(bool Open)
129{
130 const wchar *EventName=L"rar -ioff";
131 static HANDLE hEvent=NULL;
132 bool Result=false; // Return false if no other RAR -ioff are running.
133 if (Open) // Create or open the event.
134 hEvent=CreateEvent(NULL,FALSE,FALSE,EventName);
135 else
136 {
137 if (hEvent!=NULL)
138 CloseHandle(hEvent); // Close our event.
139 // Check if other copies still own the event. While race conditions
140 // are possible, they are improbable and their harm is minimal.
141 hEvent=CreateEvent(NULL,FALSE,FALSE,EventName);
142 Result=GetLastError()==ERROR_ALREADY_EXISTS;
143 if (hEvent!=NULL)
144 CloseHandle(hEvent);
145 }
146 return Result;
147}
148#endif
149
150

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected