Changeset 72571 in vbox for trunk/src/VBox/Runtime/common/fuzz/fuzz-observer.cpp
- Timestamp:
- Jun 15, 2018 8:36:17 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/fuzz/fuzz-observer.cpp
r72465 r72571 880 880 881 881 if (RT_SUCCESS(rc)) 882 { 882 883 pThis->paObsThreads = paObsThreads; 884 pThis->cThreads = cThreads; 885 } 883 886 else 884 887 RTMemFree(paObsThreads); … … 957 960 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 958 961 959 /* Wait for the master thread to terminate. */ 960 if (pThis->hThreadGlobal != NIL_RTTHREAD) 961 { 962 ASMAtomicXchgBool(&pThis->fShutdown, true); 963 RTThreadWait(pThis->hThreadGlobal, RT_INDEFINITE_WAIT, NULL); 964 } 965 966 /* Clean up the workers. */ 967 if (pThis->paObsThreads) 968 { 969 for (unsigned i = 0; i < pThis->cThreads; i++) 970 { 971 PRTFUZZOBSTHRD pThrd = &pThis->paObsThreads[i]; 972 ASMAtomicXchgBool(&pThrd->fShutdown, true); 973 RTThreadWait(pThrd->hThread, RT_INDEFINITE_WAIT, NULL); 974 if (pThrd->hFuzzInput) 975 RTFuzzInputRelease(pThrd->hFuzzInput); 976 } 977 RTMemFree(pThis->paObsThreads); 978 pThis->paObsThreads = NULL; 979 } 962 RTFuzzObsExecStop(hFuzzObs); 980 963 981 964 /* Clean up all acquired resources. */ … … 1145 1128 RTDECL(int) RTFuzzObsExecStop(RTFUZZOBS hFuzzObs) 1146 1129 { 1147 RT_NOREF(hFuzzObs); 1148 return VERR_NOT_IMPLEMENTED; 1149 } 1150 1130 PRTFUZZOBSINT pThis = hFuzzObs; 1131 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 1132 1133 /* Wait for the master thread to terminate. */ 1134 if (pThis->hThreadGlobal != NIL_RTTHREAD) 1135 { 1136 ASMAtomicXchgBool(&pThis->fShutdown, true); 1137 RTSemEventSignal(pThis->hEvtGlobal); 1138 RTThreadWait(pThis->hThreadGlobal, RT_INDEFINITE_WAIT, NULL); 1139 pThis->hThreadGlobal = NIL_RTTHREAD; 1140 } 1141 1142 /* Destroy the workers. */ 1143 if (pThis->paObsThreads) 1144 { 1145 for (unsigned i = 0; i < pThis->cThreads; i++) 1146 { 1147 PRTFUZZOBSTHRD pThrd = &pThis->paObsThreads[i]; 1148 ASMAtomicXchgBool(&pThrd->fShutdown, true); 1149 RTThreadUserSignal(pThrd->hThread); 1150 RTThreadWait(pThrd->hThread, RT_INDEFINITE_WAIT, NULL); 1151 if (pThrd->hFuzzInput) 1152 RTFuzzInputRelease(pThrd->hFuzzInput); 1153 } 1154 1155 RTMemFree(pThis->paObsThreads); 1156 pThis->paObsThreads = NULL; 1157 pThis->cThreads = 0; 1158 } 1159 1160 RTSemEventDestroy(pThis->hEvtGlobal); 1161 pThis->hEvtGlobal = NIL_RTSEMEVENT; 1162 return VINF_SUCCESS; 1163 } 1164
Note:
See TracChangeset
for help on using the changeset viewer.