diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-16 22:55:45 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-16 22:55:45 +0000 |
commit | 04aecf1372d30eb709d8de65152535ab66dcb74a (patch) | |
tree | d1e4d8c453a76465e8b63119314a28d39b474479 /src/VBox/Runtime/common | |
parent | Adding upstream version 7.0.14-dfsg. (diff) | |
download | virtualbox-04aecf1372d30eb709d8de65152535ab66dcb74a.tar.xz virtualbox-04aecf1372d30eb709d8de65152535ab66dcb74a.zip |
Adding upstream version 7.0.16-dfsg.upstream/7.0.16-dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/VBox/Runtime/common')
-rw-r--r-- | src/VBox/Runtime/common/misc/reqpool.cpp | 6 | ||||
-rw-r--r-- | src/VBox/Runtime/common/path/RTPathGlob.cpp | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/VBox/Runtime/common/misc/reqpool.cpp b/src/VBox/Runtime/common/misc/reqpool.cpp index 1489c5b7..594289c6 100644 --- a/src/VBox/Runtime/common/misc/reqpool.cpp +++ b/src/VBox/Runtime/common/misc/reqpool.cpp @@ -395,6 +395,7 @@ static DECLCALLBACK(int) rtReqPoolThreadProc(RTTHREAD hThreadSelf, void *pvArg) if (pReq) { Assert(RTListIsEmpty(&pThread->IdleNode)); /* Must not be in the idle list. */ + ASMAtomicDecU32(&pPool->cIdleThreads); /* Was already marked as idle above. */ RTCritSectLeave(&pPool->CritSect); rtReqPoolThreadProcessRequest(pPool, pThread, pReq); @@ -437,7 +438,10 @@ static DECLCALLBACK(int) rtReqPoolThreadProc(RTTHREAD hThreadSelf, void *pvArg) { uint64_t cNsIdle = RTTimeNanoTS() - pThread->uIdleNanoTs; if (cNsIdle >= pPool->cNsMinIdle) + { + ASMAtomicDecU32(&pPool->cIdleThreads); /* Was already marked as idle above. */ return rtReqPoolThreadExit(pPool, pThread, true /*fLocked*/); + } } if (RTListIsEmpty(&pThread->IdleNode)) @@ -578,7 +582,7 @@ DECLHIDDEN(void) rtReqPoolSubmit(PRTREQPOOLINT pPool, PRTREQINT pReq) * If there is an incoming worker thread already or we've reached the * maximum number of worker threads, we're done. */ - if ( pPool->cIdleThreads > 0 + if ( pPool->cIdleThreads >= pPool->cCurPendingRequests || pPool->cCurThreads >= pPool->cMaxThreads) { RTCritSectLeave(&pPool->CritSect); diff --git a/src/VBox/Runtime/common/path/RTPathGlob.cpp b/src/VBox/Runtime/common/path/RTPathGlob.cpp index 46a634b2..16527527 100644 --- a/src/VBox/Runtime/common/path/RTPathGlob.cpp +++ b/src/VBox/Runtime/common/path/RTPathGlob.cpp @@ -486,7 +486,7 @@ static DECLCALLBACK(int) rtPathVarQuery_Path(uint32_t iItem, char *pszBuf, size_ #endif if (rc == VERR_BUFFER_OVERFLOW) { - for (uint32_t iTry = 0; iTry < 10; iTry++) + for (uint32_t iTry = 0;; iTry++) { size_t cbPathBuf = RT_ALIGN_Z(cchActual + 1 + 64 * iTry, 64); pszPathFree = (char *)RTMemTmpAlloc(cbPathBuf); @@ -495,6 +495,8 @@ static DECLCALLBACK(int) rtPathVarQuery_Path(uint32_t iItem, char *pszBuf, size_ break; RTMemTmpFree(pszPathFree); AssertReturn(cchActual >= cbPathBuf, VERR_INTERNAL_ERROR_3); + if (iTry >= 9) + return rc; } pszPath = pszPathFree; } |