diff options
Diffstat (limited to 'src/VBox/Runtime/r3/posix/fileaio-posix.cpp')
-rw-r--r-- | src/VBox/Runtime/r3/posix/fileaio-posix.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/VBox/Runtime/r3/posix/fileaio-posix.cpp b/src/VBox/Runtime/r3/posix/fileaio-posix.cpp index fe7b8d05..f14e800e 100644 --- a/src/VBox/Runtime/r3/posix/fileaio-posix.cpp +++ b/src/VBox/Runtime/r3/posix/fileaio-posix.cpp @@ -122,6 +122,8 @@ typedef struct RTFILEAIOCTXINTERNAL volatile bool fWokenUp; /** Flag whether the thread is currently waiting in the syscall. */ volatile bool fWaiting; + /** Flags given during creation. */ + uint32_t fFlags; /** Magic value (RTFILEAIOCTX_MAGIC). */ uint32_t u32Magic; /** Flag whether the thread was woken up due to a internal event. */ @@ -522,12 +524,14 @@ RTDECL(int) RTFileAioReqGetRC(RTFILEAIOREQ hReq, size_t *pcbTransfered) } -RTDECL(int) RTFileAioCtxCreate(PRTFILEAIOCTX phAioCtx, uint32_t cAioReqsMax) +RTDECL(int) RTFileAioCtxCreate(PRTFILEAIOCTX phAioCtx, uint32_t cAioReqsMax, + uint32_t fFlags) { PRTFILEAIOCTXINTERNAL pCtxInt; unsigned cReqsWaitMax; AssertPtrReturn(phAioCtx, VERR_INVALID_POINTER); + AssertReturn(!(fFlags & ~RTFILEAIOCTX_FLAGS_VALID_MASK), VERR_INVALID_PARAMETER); if (cAioReqsMax == RTFILEAIO_UNLIMITED_REQS) return VERR_OUT_OF_RANGE; @@ -550,6 +554,7 @@ RTDECL(int) RTFileAioCtxCreate(PRTFILEAIOCTX phAioCtx, uint32_t cAioReqsMax) pCtxInt->u32Magic = RTFILEAIOCTX_MAGIC; pCtxInt->cMaxRequests = cAioReqsMax; pCtxInt->cReqsWaitMax = cReqsWaitMax; + pCtxInt->fFlags = fFlags; *phAioCtx = (RTFILEAIOCTX)pCtxInt; return VINF_SUCCESS; @@ -871,7 +876,8 @@ RTDECL(int) RTFileAioCtxWait(RTFILEAIOCTX hAioCtx, size_t cMinReqs, RTMSINTERVAL int32_t cRequestsWaiting = ASMAtomicReadS32(&pCtxInt->cRequests); - if (RT_UNLIKELY(cRequestsWaiting <= 0)) + if ( RT_UNLIKELY(cRequestsWaiting <= 0) + && !(pCtxInt->fFlags & RTFILEAIOCTX_FLAGS_WAIT_WITHOUT_PENDING_REQUESTS)) return VERR_FILE_AIO_NO_REQUEST; if (RT_UNLIKELY(cMinReqs > (uint32_t)cRequestsWaiting)) |