Changeset 4421 in vbox
- Timestamp:
- Aug 29, 2007 1:16:07 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/pdmthread.h
r4071 r4421 213 213 R3PTRTYPE(PFNPDMTHREADDEV) pfnThread; 214 214 /** Thread. */ 215 R3PTRTYPE(PFNPDMTHREADWAKEUPDEV) pfnWake up;215 R3PTRTYPE(PFNPDMTHREADWAKEUPDEV) pfnWakeUp; 216 216 } Dev; 217 217 … … 224 224 R3PTRTYPE(PFNPDMTHREADUSB) pfnThread; 225 225 /** Thread. */ 226 R3PTRTYPE(PFNPDMTHREADWAKEUPUSB) pfnWake up;226 R3PTRTYPE(PFNPDMTHREADWAKEUPUSB) pfnWakeUp; 227 227 } Usb; 228 228 … … 235 235 R3PTRTYPE(PFNPDMTHREADDRV) pfnThread; 236 236 /** Thread. */ 237 R3PTRTYPE(PFNPDMTHREADWAKEUPDRV) pfnWake up;237 R3PTRTYPE(PFNPDMTHREADWAKEUPDRV) pfnWakeUp; 238 238 } Drv; 239 239 … … 244 244 R3PTRTYPE(PFNPDMTHREADINT) pfnThread; 245 245 /** Thread. */ 246 R3PTRTYPE(PFNPDMTHREADWAKEUPINT) pfnWake up;246 R3PTRTYPE(PFNPDMTHREADWAKEUPINT) pfnWakeUp; 247 247 } Int; 248 248 … … 253 253 R3PTRTYPE(PFNPDMTHREADEXT) pfnThread; 254 254 /** Thread. */ 255 R3PTRTYPE(PFNPDMTHREADWAKEUPEXT) pfnWake up;255 R3PTRTYPE(PFNPDMTHREADWAKEUPEXT) pfnWakeUp; 256 256 } Ext; 257 257 } u; … … 279 279 * @param pvUser The user argument to the thread function. 280 280 * @param pfnThread The thread function. 281 * @param pfnWake up The wakup callback. This is called on the EMT thread when281 * @param pfnWakeUp The wakup callback. This is called on the EMT thread when 282 282 * a state change is pending. 283 283 * @param cbStack See RTThreadCreate. … … 286 286 */ 287 287 PDMR3DECL(int) PDMR3ThreadCreate(PVM pVM, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADINT pfnThread, 288 PFNPDMTHREADWAKEUPINT pfnWake up, size_t cbStack, RTTHREADTYPE enmType, const char *pszName);288 PFNPDMTHREADWAKEUPINT pfnWakeUp, size_t cbStack, RTTHREADTYPE enmType, const char *pszName); 289 289 290 290 /** … … 296 296 * @param pvUser The user argument to the thread function. 297 297 * @param pfnThread The thread function. 298 * @param pfnWake up The wakup callback. This is called on the EMT thread when298 * @param pfnWakeUp The wakup callback. This is called on the EMT thread when 299 299 * a state change is pending. 300 300 * @param cbStack See RTThreadCreate. … … 303 303 */ 304 304 PDMR3DECL(int) PDMR3ThreadCreateExternal(PVM pVM, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADEXT pfnThread, 305 PFNPDMTHREADWAKEUPEXT pfnWake up, size_t cbStack, RTTHREADTYPE enmType, const char *pszName);305 PFNPDMTHREADWAKEUPEXT pfnWakeUp, size_t cbStack, RTTHREADTYPE enmType, const char *pszName); 306 306 307 307 /** -
trunk/src/VBox/VMM/PDMThread.cpp
r4071 r4421 56 56 * @param pThread The PDM thread. 57 57 */ 58 static DECLCALLBACK(int) pdmR3ThreadWake up(PPDMTHREAD pThread)58 static DECLCALLBACK(int) pdmR3ThreadWakeUp(PPDMTHREAD pThread) 59 59 { 60 60 int rc; … … 62 62 { 63 63 case PDMTHREADTYPE_DEVICE: 64 rc = pThread->u.Dev.pfnWake up(pThread->u.Dev.pDevIns, pThread);64 rc = pThread->u.Dev.pfnWakeUp(pThread->u.Dev.pDevIns, pThread); 65 65 break; 66 66 67 67 case PDMTHREADTYPE_USB: 68 rc = pThread->u.Usb.pfnWake up(pThread->u.Usb.pUsbIns, pThread);68 rc = pThread->u.Usb.pfnWakeUp(pThread->u.Usb.pUsbIns, pThread); 69 69 break; 70 70 71 71 case PDMTHREADTYPE_DRIVER: 72 rc = pThread->u.Drv.pfnWake up(pThread->u.Drv.pDrvIns, pThread);72 rc = pThread->u.Drv.pfnWakeUp(pThread->u.Drv.pDrvIns, pThread); 73 73 break; 74 74 75 75 case PDMTHREADTYPE_INTERNAL: 76 rc = pThread->u.Int.pfnWake up(pThread->Internal.s.pVM, pThread);76 rc = pThread->u.Int.pfnWakeUp(pThread->Internal.s.pVM, pThread); 77 77 break; 78 78 79 79 case PDMTHREADTYPE_EXTERNAL: 80 rc = pThread->u.Ext.pfnWake up(pThread);80 rc = pThread->u.Ext.pfnWakeUp(pThread); 81 81 break; 82 82 … … 150 150 if (RT_SUCCESS(rc)) 151 151 { 152 /* 153 * Insert it into the thread list. 154 */ 155 pThread->Internal.s.pNext = NULL; 156 if (pVM->pdm.s.pThreadsTail) 157 pVM->pdm.s.pThreadsTail->Internal.s.pNext = pThread; 158 else 159 pVM->pdm.s.pThreads = pThread; 160 pVM->pdm.s.pThreadsTail = pThread; 161 152 162 rc = RTThreadUserReset(pThread->Thread); 153 163 AssertRC(rc); … … 177 187 * @param pvUser The user argument to the thread function. 178 188 * @param pfnThread The thread function. 179 * @param pfnWake up The wakup callback. This is called on the EMT thread when189 * @param pfnWakeUp The wakup callback. This is called on the EMT thread when 180 190 * a state change is pending. 181 191 * @param cbStack See RTThreadCreate. … … 184 194 */ 185 195 int pdmR3ThreadCreateDevice(PVM pVM, PPDMDEVINS pDevIns, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADDEV pfnThread, 186 PFNPDMTHREADWAKEUPDEV pfnWake up, size_t cbStack, RTTHREADTYPE enmType, const char *pszName)196 PFNPDMTHREADWAKEUPDEV pfnWakeUp, size_t cbStack, RTTHREADTYPE enmType, const char *pszName) 187 197 { 188 198 int rc = pdmR3ThreadNew(pVM, ppThread); … … 193 203 (*ppThread)->u.Dev.pDevIns = pDevIns; 194 204 (*ppThread)->u.Dev.pfnThread = pfnThread; 195 (*ppThread)->u.Dev.pfnWake up = pfnWakeup;205 (*ppThread)->u.Dev.pfnWakeUp = pfnWakeUp; 196 206 rc = pdmR3ThreadInit(pVM, ppThread, cbStack, enmType, pszName); 197 207 } … … 209 219 * @param pvUser The user argument to the thread function. 210 220 * @param pfnThread The thread function. 211 * @param pfnWake up The wakup callback. This is called on the EMT thread when221 * @param pfnWakeUp The wakup callback. This is called on the EMT thread when 212 222 * a state change is pending. 213 223 * @param cbStack See RTThreadCreate. … … 216 226 */ 217 227 int pdmR3ThreadCreateUsb(PVM pVM, PPDMUSBINS pUsbIns, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADUSB pfnThread, 218 PFNPDMTHREADWAKEUPUSB pfnWake up, size_t cbStack, RTTHREADTYPE enmType, const char *pszName)228 PFNPDMTHREADWAKEUPUSB pfnWakeUp, size_t cbStack, RTTHREADTYPE enmType, const char *pszName) 219 229 { 220 230 int rc = pdmR3ThreadNew(pVM, ppThread); … … 225 235 (*ppThread)->u.Usb.pUsbIns = pUsbIns; 226 236 (*ppThread)->u.Usb.pfnThread = pfnThread; 227 (*ppThread)->u.Usb.pfnWake up = pfnWakeup;237 (*ppThread)->u.Usb.pfnWakeUp = pfnWakeUp; 228 238 rc = pdmR3ThreadInit(pVM, ppThread, cbStack, enmType, pszName); 229 239 } … … 241 251 * @param pvUser The user argument to the thread function. 242 252 * @param pfnThread The thread function. 243 * @param pfnWake up The wakup callback. This is called on the EMT thread when253 * @param pfnWakeUp The wakup callback. This is called on the EMT thread when 244 254 * a state change is pending. 245 255 * @param cbStack See RTThreadCreate. … … 248 258 */ 249 259 int pdmR3ThreadCreateDriver(PVM pVM, PPDMDRVINS pDrvIns, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADDRV pfnThread, 250 PFNPDMTHREADWAKEUPDRV pfnWake up, size_t cbStack, RTTHREADTYPE enmType, const char *pszName)260 PFNPDMTHREADWAKEUPDRV pfnWakeUp, size_t cbStack, RTTHREADTYPE enmType, const char *pszName) 251 261 { 252 262 int rc = pdmR3ThreadNew(pVM, ppThread); … … 257 267 (*ppThread)->u.Drv.pDrvIns = pDrvIns; 258 268 (*ppThread)->u.Drv.pfnThread = pfnThread; 259 (*ppThread)->u.Drv.pfnWake up = pfnWakeup;269 (*ppThread)->u.Drv.pfnWakeUp = pfnWakeUp; 260 270 rc = pdmR3ThreadInit(pVM, ppThread, cbStack, enmType, pszName); 261 271 } … … 272 282 * @param pvUser The user argument to the thread function. 273 283 * @param pfnThread The thread function. 274 * @param pfnWake up The wakup callback. This is called on the EMT thread when284 * @param pfnWakeUp The wakup callback. This is called on the EMT thread when 275 285 * a state change is pending. 276 286 * @param cbStack See RTThreadCreate. … … 279 289 */ 280 290 PDMR3DECL(int) PDMR3ThreadCreate(PVM pVM, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADINT pfnThread, 281 PFNPDMTHREADWAKEUPINT pfnWake up, size_t cbStack, RTTHREADTYPE enmType, const char *pszName)291 PFNPDMTHREADWAKEUPINT pfnWakeUp, size_t cbStack, RTTHREADTYPE enmType, const char *pszName) 282 292 { 283 293 int rc = pdmR3ThreadNew(pVM, ppThread); … … 287 297 (*ppThread)->Internal.s.enmType = PDMTHREADTYPE_INTERNAL; 288 298 (*ppThread)->u.Int.pfnThread = pfnThread; 289 (*ppThread)->u.Int.pfnWake up = pfnWakeup;299 (*ppThread)->u.Int.pfnWakeUp = pfnWakeUp; 290 300 rc = pdmR3ThreadInit(pVM, ppThread, cbStack, enmType, pszName); 291 301 } … … 302 312 * @param pvUser The user argument to the thread function. 303 313 * @param pfnThread The thread function. 304 * @param pfnWake up The wakup callback. This is called on the EMT thread when314 * @param pfnWakeUp The wakup callback. This is called on the EMT thread when 305 315 * a state change is pending. 306 316 * @param cbStack See RTThreadCreate. … … 309 319 */ 310 320 PDMR3DECL(int) PDMR3ThreadCreateExternal(PVM pVM, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADEXT pfnThread, 311 PFNPDMTHREADWAKEUPEXT pfnWake up, size_t cbStack, RTTHREADTYPE enmType, const char *pszName)321 PFNPDMTHREADWAKEUPEXT pfnWakeUp, size_t cbStack, RTTHREADTYPE enmType, const char *pszName) 312 322 { 313 323 int rc = pdmR3ThreadNew(pVM, ppThread); … … 317 327 (*ppThread)->Internal.s.enmType = PDMTHREADTYPE_EXTERNAL; 318 328 (*ppThread)->u.Ext.pfnThread = pfnThread; 319 (*ppThread)->u.Ext.pfnWake up = pfnWakeup;329 (*ppThread)->u.Ext.pfnWakeUp = pfnWakeUp; 320 330 rc = pdmR3ThreadInit(pVM, ppThread, cbStack, enmType, pszName); 321 331 } … … 362 372 if (!pdmR3AtomicCmpXchgState(pThread, PDMTHREADSTATE_TERMINATING, enmState)) 363 373 continue; 364 rc = pdmR3ThreadWake up(pThread);374 rc = pdmR3ThreadWakeUp(pThread); 365 375 break; 366 376 377 case PDMTHREADSTATE_SUSPENDED: 367 378 case PDMTHREADSTATE_SUSPENDING: 368 case PDMTHREADSTATE_SUSPENDED:369 379 case PDMTHREADSTATE_RESUMING: 370 380 case PDMTHREADSTATE_INITIALIZING: … … 385 395 } 386 396 } 397 int rc2 = RTSemEventMultiSignal(pThread->Internal.s.BlockEvent); 398 AssertRC(rc2); 387 399 388 400 /* 389 401 * Wait for it to terminate and the do cleanups. 390 402 */ 391 intrc2 = RTThreadWait(pThread->Thread, RT_SUCCESS(rc) ? 60*1000 : 150, pRcThread);403 rc2 = RTThreadWait(pThread->Thread, RT_SUCCESS(rc) ? 60*1000 : 150, pRcThread); 392 404 if (RT_SUCCESS(rc2)) 393 405 { … … 399 411 /* unlink */ 400 412 if (pVM->pdm.s.pThreads == pThread) 413 { 401 414 pVM->pdm.s.pThreads = pThread->Internal.s.pNext; 415 if (!pThread->Internal.s.pNext) 416 pVM->pdm.s.pThreadsTail = NULL; 417 } 402 418 else 403 419 { … … 408 424 if (pPrev) 409 425 pPrev->Internal.s.pNext = pThread->Internal.s.pNext; 410 } 411 if (pVM->pdm.s.pThreadsTail == pThread) 412 { 413 Assert(pVM->pdm.s.pThreads == NULL); 414 pVM->pdm.s.pThreadsTail = NULL; 426 if (!pThread->Internal.s.pNext) 427 pVM->pdm.s.pThreadsTail = pPrev; 415 428 } 416 429 pThread->Internal.s.pNext = NULL; … … 784 797 if (!pdmR3AtomicCmpXchgState(pThread, PDMTHREADSTATE_TERMINATING, enmState)) 785 798 continue; 786 pdmR3ThreadWake up(pThread);799 pdmR3ThreadWakeUp(pThread); 787 800 break; 788 801 … … 835 848 if (pdmR3AtomicCmpXchgState(pThread, PDMTHREADSTATE_SUSPENDING, PDMTHREADSTATE_RUNNING)) 836 849 { 837 rc = pdmR3ThreadWake up(pThread);850 rc = pdmR3ThreadWakeUp(pThread); 838 851 if (RT_SUCCESS(rc)) 839 852 { … … 883 896 } 884 897 898 /* suspend -> power off; voluntary suspend. */ 899 case PDMTHREADSTATE_SUSPENDED: 900 break; 901 885 902 default: 886 903 AssertMsgFailed(("pThread=%p enmState=%d\n", pThread, pThread->enmState));
Note:
See TracChangeset
for help on using the changeset viewer.