Changeset 28420 in vbox for trunk/src/VBox/Additions/common
- Timestamp:
- Apr 16, 2010 1:32:14 PM (15 years ago)
- Location:
- trunk/src/VBox/Additions/common/VBoxService
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControl.cpp
r28409 r28420 48 48 static uint32_t g_GuestControlSvcClientID = 0; 49 49 /** List of spawned processes */ 50 GuestCtrlExecThreadsg_GuestControlExecThreads;50 RTLISTNODE g_GuestControlExecThreads; 51 51 52 52 … … 94 94 } 95 95 96 /* Init thread list. */ 97 RTListInit(&g_GuestControlExecThreads); 96 98 return rc; 97 99 } … … 239 241 { 240 242 /* Shutdown spawned processes threads. */ 241 for (GuestCtrlExecListIter it = g_GuestControlExecThreads.begin(); 242 it != g_GuestControlExecThreads.end(); it++) 243 { 244 ASMAtomicXchgBool(&(*it)->fShutdown, true); 245 } 246 247 for (GuestCtrlExecListIter it = g_GuestControlExecThreads.begin(); 248 it != g_GuestControlExecThreads.end(); it++) 249 { 250 if ((*it)->Thread != NIL_RTTHREAD) 251 { 252 int rc2 = RTThreadWait((*it)->Thread, 30 * 1000 /* Wait 30 second */, NULL); 243 PVBOXSERVICECTRLTHREAD pNode = RTListNodeGetFirst(&g_GuestControlExecThreads, VBOXSERVICECTRLTHREAD, Node); 244 while (pNode) 245 { 246 ASMAtomicXchgBool(&pNode->fShutdown, true); 247 if (RTListNodeIsLast(&g_GuestControlExecThreads, &pNode->Node)) 248 break; 249 pNode = RTListNodeGetNext(&pNode->Node, VBOXSERVICECTRLTHREAD, Node); 250 } 251 252 pNode = RTListNodeGetFirst(&g_GuestControlExecThreads, VBOXSERVICECTRLTHREAD, Node); 253 while (pNode) 254 { 255 if (pNode->Thread != NIL_RTTHREAD) 256 { 257 int rc2 = RTThreadWait(pNode->Thread, 30 * 1000 /* Wait 30 seconds max. */, NULL); 253 258 if (RT_FAILURE(rc2)) 254 VBoxServiceError("Control: Thread (PID: %u) failed to stop; rc2=%Rrc\n", (*it)->uPID, rc2); 255 } 256 VBoxServiceControlExecDestroyThreadData((*it)); 257 } 258 259 for (GuestCtrlExecListIter it = g_GuestControlExecThreads.begin(); 260 it != g_GuestControlExecThreads.end(); it++) 261 RTMemFree((*it)); 262 263 g_GuestControlExecThreads.clear(); 259 VBoxServiceError("Control: Thread (PID: %u) failed to stop; rc2=%Rrc\n", pNode->uPID, rc2); 260 } 261 VBoxServiceControlExecDestroyThreadData(pNode); 262 if (RTListNodeIsLast(&g_GuestControlExecThreads, &pNode->Node)) 263 break; 264 pNode = RTListNodeGetNext(&pNode->Node, VBOXSERVICECTRLTHREAD, Node); 265 } 266 267 pNode = RTListNodeGetFirst(&g_GuestControlExecThreads, VBOXSERVICECTRLTHREAD, Node); 268 while (pNode) 269 { 270 RTListNodeRemove(&pNode->Node); 271 RTMemFree(pNode); 272 if (RTListNodeIsLast(&g_GuestControlExecThreads, &pNode->Node)) 273 break; 274 275 PVBOXSERVICECTRLTHREAD pNext = RTListNodeGetNext(&pNode->Node, VBOXSERVICECTRLTHREAD, Node); 276 pNode = pNext; 277 } 278 264 279 VbglR3GuestCtrlDisconnect(g_GuestControlSvcClientID); 265 280 g_GuestControlSvcClientID = 0; -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlExec.cpp
r28410 r28420 50 50 using namespace guestControl; 51 51 52 extern GuestCtrlExecThreadsg_GuestControlExecThreads;52 extern RTLISTNODE g_GuestControlExecThreads; 53 53 54 54 /** … … 537 537 { 538 538 AssertPtr(pThread); 539 540 pThread->Node.pPrev = NULL; 541 pThread->Node.pNext = NULL; 539 542 540 543 pThread->fShutdown = false; … … 802 805 else 803 806 { 804 g_GuestControlExecThreads.push_back(pThread);807 /*rc =*/ RTListAppend(&g_GuestControlExecThreads, &pThread->Node); 805 808 } 806 809 } -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceInternal.h
r28409 r28420 28 28 # include <process.h> /* Needed for file version information. */ 29 29 #endif 30 30 31 #ifdef VBOX_WITH_GUEST_CONTROL 31 # include < list>32 # include <iprt/list.h> 32 33 #endif 33 34 … … 132 133 typedef struct 133 134 { 135 /** Node. */ 136 RTLISTNODE Node; 134 137 /** The worker thread. */ 135 138 RTTHREAD Thread; … … 228 231 229 232 #ifdef VBOX_WITH_GUEST_CONTROL 230 using namespace std;231 232 typedef std::list< PVBOXSERVICECTRLTHREAD > GuestCtrlExecThreads;233 typedef std::list< PVBOXSERVICECTRLTHREAD >::iterator GuestCtrlExecListIter;234 typedef std::list< PVBOXSERVICECTRLTHREAD >::const_iterator GuestCtrlExecListIterConst;235 236 233 extern int VBoxServiceControlExecProcess(uint32_t uContext, const char *pszCmd, uint32_t uFlags, 237 234 const char *pszArgs, uint32_t uNumArgs,
Note:
See TracChangeset
for help on using the changeset viewer.