- Timestamp:
- Jun 25, 2009 11:54:56 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/nt/semevent-r0drv-nt.cpp
r20923 r20929 62 62 { 63 63 Assert(sizeof(RTSEMEVENTINTERNAL) > sizeof(void *)); 64 PRTSEMEVENTINTERNAL p EventInt = (PRTSEMEVENTINTERNAL)RTMemAlloc(sizeof(*pEventInt));65 if (p EventInt)64 PRTSEMEVENTINTERNAL pThis = (PRTSEMEVENTINTERNAL)RTMemAlloc(sizeof(*pThis)); 65 if (pThis) 66 66 { 67 p EventInt->u32Magic = RTSEMEVENT_MAGIC;68 KeInitializeEvent(&p EventInt->Event, SynchronizationEvent, FALSE);69 *pEventSem = p EventInt;67 pThis->u32Magic = RTSEMEVENT_MAGIC; 68 KeInitializeEvent(&pThis->Event, SynchronizationEvent, FALSE); 69 *pEventSem = pThis; 70 70 return VINF_SUCCESS; 71 71 } … … 79 79 * Validate input. 80 80 */ 81 PRTSEMEVENTINTERNAL p EventInt= (PRTSEMEVENTINTERNAL)EventSem;82 if (!p EventInt)81 PRTSEMEVENTINTERNAL pThis = (PRTSEMEVENTINTERNAL)EventSem; 82 if (!pThis) 83 83 return VERR_INVALID_PARAMETER; 84 if (p EventInt->u32Magic != RTSEMEVENT_MAGIC)84 if (pThis->u32Magic != RTSEMEVENT_MAGIC) 85 85 { 86 AssertMsgFailed(("p EventInt->u32Magic=%RX32 pEventInt=%p\n", pEventInt->u32Magic, pEventInt));86 AssertMsgFailed(("pThis->u32Magic=%RX32 pThis=%p\n", pThis->u32Magic, pThis)); 87 87 return VERR_INVALID_PARAMETER; 88 88 } … … 91 91 * Invalidate it and signal the object just in case. 92 92 */ 93 ASMAtomicIncU32(&p EventInt->u32Magic);94 KeSetEvent(&p EventInt->Event, 0xfff, FALSE);95 RTMemFree(p EventInt);93 ASMAtomicIncU32(&pThis->u32Magic); 94 KeSetEvent(&pThis->Event, 0xfff, FALSE); 95 RTMemFree(pThis); 96 96 return VINF_SUCCESS; 97 97 } … … 103 103 * Validate input. 104 104 */ 105 PRTSEMEVENTINTERNAL p EventInt= (PRTSEMEVENTINTERNAL)EventSem;106 if (!p EventInt)105 PRTSEMEVENTINTERNAL pThis = (PRTSEMEVENTINTERNAL)EventSem; 106 if (!pThis) 107 107 return VERR_INVALID_PARAMETER; 108 if ( !p EventInt109 || p EventInt->u32Magic != RTSEMEVENT_MAGIC)108 if ( !pThis 109 || pThis->u32Magic != RTSEMEVENT_MAGIC) 110 110 { 111 AssertMsgFailed(("p EventInt->u32Magic=%RX32 pEventInt=%p\n", pEventInt ? pEventInt->u32Magic : 0, pEventInt));111 AssertMsgFailed(("pThis->u32Magic=%RX32 pThis=%p\n", pThis ? pThis->u32Magic : 0, pThis)); 112 112 return VERR_INVALID_PARAMETER; 113 113 } … … 116 116 * Signal the event object. 117 117 */ 118 KeSetEvent(&p EventInt->Event, 1, FALSE);118 KeSetEvent(&pThis->Event, 1, FALSE); 119 119 return VINF_SUCCESS; 120 120 } … … 126 126 * Validate input. 127 127 */ 128 PRTSEMEVENTINTERNAL p EventInt= (PRTSEMEVENTINTERNAL)EventSem;129 if (!p EventInt)128 PRTSEMEVENTINTERNAL pThis = (PRTSEMEVENTINTERNAL)EventSem; 129 if (!pThis) 130 130 return VERR_INVALID_PARAMETER; 131 if ( !p EventInt132 || p EventInt->u32Magic != RTSEMEVENT_MAGIC)131 if ( !pThis 132 || pThis->u32Magic != RTSEMEVENT_MAGIC) 133 133 { 134 AssertMsgFailed(("p EventInt->u32Magic=%RX32 pEventInt=%p\n", pEventInt ? pEventInt->u32Magic : 0, pEventInt));134 AssertMsgFailed(("pThis->u32Magic=%RX32 pThis=%p\n", pThis ? pThis->u32Magic : 0, pThis)); 135 135 return VERR_INVALID_PARAMETER; 136 136 } … … 143 143 KPROCESSOR_MODE WaitMode = fInterruptible ? UserMode : KernelMode; 144 144 if (cMillies == RT_INDEFINITE_WAIT) 145 rcNt = KeWaitForSingleObject(&p EventInt->Event, Executive, WaitMode, fInterruptible, NULL);145 rcNt = KeWaitForSingleObject(&pThis->Event, Executive, WaitMode, fInterruptible, NULL); 146 146 else 147 147 { 148 148 LARGE_INTEGER Timeout; 149 149 Timeout.QuadPart = -(int64_t)cMillies * 10000; 150 rcNt = KeWaitForSingleObject(&p EventInt->Event, Executive, WaitMode, fInterruptible, &Timeout);150 rcNt = KeWaitForSingleObject(&pThis->Event, Executive, WaitMode, fInterruptible, &Timeout); 151 151 } 152 152 switch (rcNt) 153 153 { 154 154 case STATUS_SUCCESS: 155 if (p EventInt->u32Magic == RTSEMEVENT_MAGIC)155 if (pThis->u32Magic == RTSEMEVENT_MAGIC) 156 156 return VINF_SUCCESS; 157 157 return VERR_SEM_DESTROYED; … … 163 163 return VERR_TIMEOUT; 164 164 default: 165 AssertMsgFailed(("p EventInt->u32Magic=%RX32 pEventInt=%p: wait returned %lx!\n",166 p EventInt->u32Magic, pEventInt, (long)rcNt));165 AssertMsgFailed(("pThis->u32Magic=%RX32 pThis=%p: wait returned %lx!\n", 166 pThis->u32Magic, pThis, (long)rcNt)); 167 167 return VERR_INTERNAL_ERROR; 168 168 }
Note:
See TracChangeset
for help on using the changeset viewer.