- Timestamp:
- Oct 27, 2009 12:02:12 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/misc/req.cpp
r21337 r24100 66 66 67 67 int rc = RTSemEventCreate(&(*ppQueue)->EventSem); 68 if ( rc != VINF_SUCCESS)68 if (RT_SUCCESS(rc)) 69 69 RTMemFree(*ppQueue); 70 70 … … 86 86 */ 87 87 if (!pQueue) 88 { 89 AssertFailed(); 90 return VERR_INVALID_PARAMETER; 91 } 88 return VINF_SUCCESS; 89 AssertPtr(pQueue); 92 90 RTSemEventDestroy(pQueue->EventSem); 91 pQueue->EventSem = NIL_RTSEMEVENT; 93 92 RTMemFree(pQueue); 94 93 return VINF_SUCCESS; 95 94 } 96 95 RT_EXPORT_SYMBOL(RTReqDestroyQueue); 96 97 97 98 98 /** … … 133 133 if (!pReqs) 134 134 { 135 /** @note We currently don't care if the entire time wasted here is larger than cMillies */ 135 ASMAtomicWriteBool(&pQueue->fBusy, false); /* this aint 100% perfect, but it's good enough for now... */ 136 /** @todo We currently don't care if the entire time wasted here is larger than 137 * cMillies */ 136 138 rc = RTSemEventWait(pQueue->EventSem, cMillies); 137 139 if (rc != VINF_SUCCESS) … … 139 141 continue; 140 142 } 143 ASMAtomicWriteBool(&pQueue->fBusy, true); 141 144 142 145 /* … … 677 680 pNext = pQueue->pReqs; 678 681 pReq->pNext = pNext; 682 ASMAtomicWriteBool(&pQueue->fBusy, true); 679 683 } while (!ASMAtomicCmpXchgPtr((void * volatile *)&pQueue->pReqs, (void *)pReq, (void *)pNext)); 680 684 … … 902 906 } 903 907 908 909 /** 910 * Checks if the queue is busy or not. 911 * 912 * The caller is responsible for dealing with any concurrent submitts. 913 * 914 * @returns true if busy, false if idle. 915 * @param pQueue The queue. 916 */ 917 RTDECL(bool) RTReqIsBusy(PRTREQQUEUE pQueue) 918 { 919 AssertPtrReturn(pQueue, false); 920 921 if (ASMAtomicReadBool(&pQueue->fBusy)) 922 return true; 923 if (ASMAtomicReadPtr((void * volatile *)&pQueue->pReqs) != NULL) 924 return true; 925 if (ASMAtomicReadBool(&pQueue->fBusy)) 926 return true; 927 return false; 928 } 929 RT_EXPORT_SYMBOL(RTReqIsBusy);
Note:
See TracChangeset
for help on using the changeset viewer.