Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 1e99c9e

Browse files
Cleanup (squash)
1 parent da3bf23 commit 1e99c9e

File tree

1 file changed

+29
-28
lines changed

1 file changed

+29
-28
lines changed

src/pal/src/synchmgr/synchmanager.cpp

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Module Name:
3838
// We use the synchronization manager's worker thread to handle
3939
// process termination requests. It does so by calling the
4040
// registered handler function.
41-
PTERMINATION_REQUEST_HANDLER g_terminationRequestHandler = nullptr;
41+
PTERMINATION_REQUEST_HANDLER g_terminationRequestHandler = NULL;
4242

4343
// Set the handler for process termination requests.
4444
VOID PALAPI PAL_SetTerminationRequestHandler(
@@ -180,9 +180,9 @@ namespace CorUnix
180180
Method:
181181
CPalSynchronizationManager::BlockThread
182182
183-
Call by a thread to go to sleep for a wait or a sleep
183+
Called by a thread to go to sleep for a wait or a sleep
184184
185-
NOTE: This methot must must be called without holding any
185+
NOTE: This method must must be called without holding any
186186
synchronization lock (as well as other locks)
187187
--*/
188188
PAL_ERROR CPalSynchronizationManager::BlockThread(
@@ -200,7 +200,7 @@ namespace CorUnix
200200
DWORD dwSigObjIdx = 0;
201201
bool fRaceAlerted = false;
202202
bool fEarlyDeath = false;
203-
203+
204204
pdwWaitState = SharedIDToTypePointer(DWORD,
205205
pthrCurrent->synchronizationInfo.m_shridWaitAwakened);
206206

@@ -234,7 +234,7 @@ namespace CorUnix
234234
// native wait
235235
fRaceAlerted = true;
236236
}
237-
}
237+
}
238238

239239
if (!fRaceAlerted)
240240
{
@@ -277,7 +277,7 @@ namespace CorUnix
277277
}
278278
}
279279

280-
if (fAlertable)
280+
if (fAlertable)
281281
{
282282
// Unlock
283283
ReleaseSharedSynchLock(pthrCurrent);
@@ -486,7 +486,7 @@ namespace CorUnix
486486
if (ETIMEDOUT == iWaitRet)
487487
{
488488
_ASSERT_MSG(INFINITE != dwTimeout,
489-
"Got a ETIMEDOUT despite timeout was INFINITE\n");
489+
"Got ETIMEDOUT despite timeout being INFINITE\n");
490490
break;
491491
}
492492
else if (0 != iWaitRet)
@@ -529,7 +529,7 @@ namespace CorUnix
529529
}
530530

531531
_ASSERT_MSG(ETIMEDOUT != iRet || INFINITE != dwTimeout,
532-
"Got time out return code with INFINITE timeout\n");
532+
"Got timeout return code with INFINITE timeout\n");
533533

534534
if (0 == iWaitRet)
535535
{
@@ -787,8 +787,8 @@ namespace CorUnix
787787
rgObjects,
788788
dwObjectCount,
789789
(void **)rgControllers,
790-
CSynchControllerBase::WaitController);
791-
}
790+
CSynchControllerBase::WaitController);
791+
}
792792

793793
/*++
794794
Method:
@@ -808,7 +808,7 @@ namespace CorUnix
808808
dwObjectCount,
809809
(void **)rgControllers,
810810
CSynchControllerBase::StateController);
811-
}
811+
}
812812

813813
/*++
814814
Method:
@@ -1059,9 +1059,9 @@ namespace CorUnix
10591059
if (NULLSharedID == shridSynchData)
10601060
{
10611061
ERROR("Unable to allocate shared memory\n");
1062-
palErr = ERROR_NOT_ENOUGH_MEMORY;
1063-
goto AOSD_exit;
1062+
return ERROR_NOT_ENOUGH_MEMORY;
10641063
}
1064+
10651065
psdSynchData = SharedIDToTypePointer(CSynchData, shridSynchData);
10661066

10671067
VALIDATEOBJECT(psdSynchData);
@@ -1074,7 +1074,7 @@ namespace CorUnix
10741074

10751075
// Store shared pointer to this object
10761076
psdSynchData->SetSharedThis(shridSynchData);
1077-
1077+
10781078
*ppvSynchData = reinterpret_cast<void *>(shridSynchData);
10791079
}
10801080
else
@@ -1083,10 +1083,9 @@ namespace CorUnix
10831083
if (NULL == psdSynchData)
10841084
{
10851085
ERROR("Unable to allocate memory\n");
1086-
palErr = ERROR_NOT_ENOUGH_MEMORY;
1087-
goto AOSD_exit;
1086+
return ERROR_NOT_ENOUGH_MEMORY;
10881087
}
1089-
1088+
10901089
// Initialize waiting list pointers
10911090
psdSynchData->SetWTLHeadPtr(NULL);
10921091
psdSynchData->SetWTLTailPtr(NULL);
@@ -1095,16 +1094,15 @@ namespace CorUnix
10951094
psdSynchData->SetSharedThis(NULLSharedID);
10961095

10971096
*ppvSynchData = static_cast<void *>(psdSynchData);
1098-
}
1097+
}
10991098

11001099
// Initialize object domain and object type;
11011100
psdSynchData->SetObjectDomain(odObjectDomain);
11021101
psdSynchData->SetObjectType(potObjectType);
11031102

1104-
AOSD_exit:
11051103
return palErr;
1106-
}
1107-
1104+
}
1105+
11081106
/*++
11091107
Method:
11101108
CPalSynchronizationManager::FreeObjectSynchData
@@ -1127,10 +1125,11 @@ namespace CorUnix
11271125
{
11281126
psdSynchData = SharedIDToTypePointer(CSynchData,
11291127
reinterpret_cast<SharedID>(pvSynchData));
1128+
11301129
if (NULL == psdSynchData)
11311130
{
11321131
ASSERT("Bad shared memory pointer\n");
1133-
goto FOSD_exit;
1132+
return;
11341133
}
11351134
}
11361135
else
@@ -1139,9 +1138,6 @@ namespace CorUnix
11391138
}
11401139

11411140
psdSynchData->Release(pthrCurrent);
1142-
1143-
FOSD_exit:
1144-
return;
11451141
}
11461142

11471143
/*++
@@ -1843,7 +1839,7 @@ namespace CorUnix
18431839
DWORD TerminationRequestHandlingRoutine(LPVOID pArg)
18441840
{
18451841
// Call the termination request handler if one is registered.
1846-
if (g_terminationRequestHandler != nullptr)
1842+
if (g_terminationRequestHandler != NULL)
18471843
{
18481844
g_terminationRequestHandler();
18491845
}
@@ -1890,7 +1886,7 @@ namespace CorUnix
18901886
case SynchWorkerCmdTerminationRequest:
18911887
// This worker thread is being asked to initiate process termination
18921888

1893-
HANDLE hShutdownThread;
1889+
HANDLE hTerminationRequestHandlingThread;
18941890
palErr = InternalCreateThread(pthrWorker,
18951891
NULL,
18961892
0,
@@ -1899,13 +1895,18 @@ namespace CorUnix
18991895
0,
19001896
PalWorkerThread,
19011897
NULL,
1902-
&hShutdownThread);
1898+
&hTerminationRequestHandlingThread);
19031899

19041900
if (NO_ERROR != palErr)
19051901
{
19061902
ERROR("Unable to create worker thread\n");
19071903
}
19081904

1905+
if (hTerminationRequestHandlingThread != NULL)
1906+
{
1907+
CloseHandle(hTerminationRequestHandlingThread);
1908+
}
1909+
19091910
break;
19101911
case SynchWorkerCmdNop:
19111912
TRACE("Synch Worker: received SynchWorkerCmdNop\n");

0 commit comments

Comments
 (0)