- Timestamp:
- Jun 18, 2020 3:37:09 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlProcess.cpp
r84238 r84873 253 253 254 254 int rc = vgsvcGstCtrlProcessLock(pProcess); 255 if ( RT_SUCCESS(rc) 256 && pProcess->Thread != NIL_RTTHREAD) /* Is there a thread we can wait for? */ 257 { 258 VGSvcVerbose(2, "[PID %RU32]: Waiting for shutdown (%RU32ms) ...\n", pProcess->uPID, msTimeout); 259 260 AssertMsgReturn(pProcess->fStarted, 261 ("Tried to wait on guest process=%p (PID %RU32) which has not been started yet\n", 262 pProcess, pProcess->uPID), VERR_INVALID_PARAMETER); 263 264 /* Unlock process before waiting. */ 265 rc = vgsvcGstCtrlProcessUnlock(pProcess); 266 AssertRC(rc); 267 268 /* Do the actual waiting. */ 269 int rcThread; 270 Assert(pProcess->Thread != NIL_RTTHREAD); 271 rc = RTThreadWait(pProcess->Thread, msTimeout, &rcThread); 272 273 int rc2 = vgsvcGstCtrlProcessLock(pProcess); 255 if (RT_SUCCESS(rc)) 256 { 257 if (RTThreadGetState(pProcess->Thread) != RTTHREADSTATE_INVALID) /* Is there a thread we can wait for? */ 258 { 259 VGSvcVerbose(2, "[PID %RU32]: Waiting for shutdown (%RU32ms) ...\n", pProcess->uPID, msTimeout); 260 261 AssertMsgReturn(pProcess->fStarted, 262 ("Tried to wait on guest process=%p (PID %RU32) which has not been started yet\n", 263 pProcess, pProcess->uPID), VERR_INVALID_PARAMETER); 264 265 /* Unlock process before waiting. */ 266 rc = vgsvcGstCtrlProcessUnlock(pProcess); 267 AssertRC(rc); 268 269 /* Do the actual waiting. */ 270 int rcThread; 271 Assert(pProcess->Thread != NIL_RTTHREAD); 272 rc = RTThreadWait(pProcess->Thread, msTimeout, &rcThread); 273 274 int rc2 = vgsvcGstCtrlProcessLock(pProcess); 275 AssertRC(rc2); 276 277 if (RT_SUCCESS(rc)) 278 { 279 pProcess->Thread = NIL_RTTHREAD; 280 VGSvcVerbose(3, "[PID %RU32]: Thread shutdown complete, thread rc=%Rrc\n", pProcess->uPID, rcThread); 281 if (prc) 282 *prc = rcThread; 283 } 284 } 285 286 int rc2 = vgsvcGstCtrlProcessUnlock(pProcess); 274 287 AssertRC(rc2); 275 276 if (RT_SUCCESS(rc)) 277 { 278 pProcess->Thread = NIL_RTTHREAD; 279 VGSvcVerbose(3, "[PID %RU32]: Thread shutdown complete, thread rc=%Rrc\n", pProcess->uPID, rcThread); 280 if (prc) 281 *prc = rcThread; 282 } 283 else 284 VGSvcError("[PID %RU32]: Waiting for shutting down thread returned error rc=%Rrc\n", pProcess->uPID, rc); 285 286 rc2 = vgsvcGstCtrlProcessUnlock(pProcess); 287 AssertRC(rc2); 288 } 288 } 289 290 if (RT_FAILURE(rc)) 291 VGSvcError("[PID %RU32]: Waiting for shutting down thread returned error rc=%Rrc\n", pProcess->uPID, rc); 289 292 290 293 VGSvcVerbose(3, "[PID %RU32]: Waiting resulted in rc=%Rrc\n", pProcess->uPID, rc);
Note:
See TracChangeset
for help on using the changeset viewer.