diff options
author | Koundinya Veluri <kouvel@users.noreply.github.com> | 2019-06-29 00:27:20 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-29 00:27:20 -0700 |
commit | e0a9df573c1d208dc70b92cc7fcb7e487614c4f1 (patch) | |
tree | 63401a303adeb7408de30ac68b8634ef24ab2838 /src/pal | |
parent | 5ce8eaf4d4acad83f8e38095651ff765d339aab2 (diff) | |
download | coreclr-e0a9df573c1d208dc70b92cc7fcb7e487614c4f1.tar.gz coreclr-e0a9df573c1d208dc70b92cc7fcb7e487614c4f1.tar.bz2 coreclr-e0a9df573c1d208dc70b92cc7fcb7e487614c4f1.zip |
Fix a mutex abandon case with WaitHandle.WaitAll in the PAL (#25452)
Fixes https://github.com/dotnet/coreclr/issues/25108
- Upon a `WaitAll` when all waits are already satisfied, the abandoned flag is overwritten with the abandoned state of the last wait object in the array
- So if the first wait object is an abandoned mutex and the second wait object is a signaled event, the `WaitAll` succeeds and does not report that anything was abandoned
- Fixed to accumulate into the flag instead of overwriting it
Diffstat (limited to 'src/pal')
-rw-r--r-- | src/pal/src/synchmgr/wait.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/pal/src/synchmgr/wait.cpp b/src/pal/src/synchmgr/wait.cpp index 31153ae02b..1f20ba23bf 100644 --- a/src/pal/src/synchmgr/wait.cpp +++ b/src/pal/src/synchmgr/wait.cpp @@ -531,8 +531,8 @@ DWORD CorUnix::InternalWaitForMultipleObjectsEx( iSignaledObjIndex = -1; for (i=0;i<(int)nCount;i++) { - bool fValue; - palErr = ppISyncWaitCtrlrs[i]->CanThreadWaitWithoutBlocking(&fValue, &fAbandoned); + bool fValue, fWaitObjectAbandoned = false; + palErr = ppISyncWaitCtrlrs[i]->CanThreadWaitWithoutBlocking(&fValue, &fWaitObjectAbandoned); if (NO_ERROR != palErr) { ERROR("ISynchWaitController::CanThreadWaitWithoutBlocking() failed for " @@ -540,6 +540,10 @@ DWORD CorUnix::InternalWaitForMultipleObjectsEx( pThread->SetLastError(ERROR_INTERNAL_ERROR); goto WFMOExIntReleaseControllers; } + if (fWaitObjectAbandoned) + { + fAbandoned = true; + } if (fValue) { iSignaledObjCount++; |