Changeset 33166 in vbox
- Timestamp:
- Oct 15, 2010 6:09:39 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/solaris/semeventwait-r0drv-solaris.h
r33152 r33166 72 72 /** Cylic timer ID (used by the timeout callback). */ 73 73 cyclic_id_t idCy; 74 /** The mutex associated with the condition variable wait. */ 75 void volatile *pvMtx; 74 76 } RTR0SEMSOLWAIT; 75 77 /** Pointer to a solaris semaphore wait structure. */ … … 160 162 pWait->fInterruptible = !!(fFlags & RTSEMWAIT_FLAGS_INTERRUPTIBLE); 161 163 pWait->pThread = curthread; 164 pWait->pvMtx = NULL; 162 165 pWait->idCy = CYCLIC_NONE; 163 166 … … 176 179 PRTR0SEMSOLWAIT pWait = (PRTR0SEMSOLWAIT)pvUser; 177 180 kthread_t *pThread = pWait->pThread; 178 if (VALID_PTR(pThread)) /* paranoia */ 179 { 180 /* Note: Trying to take the cpu_lock here doesn't work. */ 181 kmutex_t *pMtx = (kmutex_t *)ASMAtomicReadPtr(&pWait->pvMtx); 182 if (VALID_PTR(pMtx)) 183 { 184 /* Enter the mutex here to make sure the thread has gone to sleep 185 before we wake it up. 186 Note: Trying to take the cpu_lock here doesn't work. */ 187 mutex_enter(pMtx); 181 188 if (mutex_owner(&cpu_lock) == curthread) 182 189 { … … 185 192 } 186 193 ASMAtomicWriteBool(&pWait->fTimedOut, true); 194 mutex_exit(pMtx); 187 195 setrun(pThread); 188 196 } … … 200 208 PRTR0SEMSOLWAIT pWait = (PRTR0SEMSOLWAIT)pvUser; 201 209 kthread_t *pThread = pWait->pThread; 202 if (VALID_PTR(pThread)) /* paranoia */ 203 { 210 kmutex_t *pMtx = (kmutex_t *)ASMAtomicReadPtr(&pWait->pvMtx); 211 if (VALID_PTR(pMtx)) 212 { 213 /* Enter the mutex here to make sure the thread has gone to sleep 214 before we wake it up. */ 215 mutex_enter(pMtx); 204 216 ASMAtomicWriteBool(&pWait->fTimedOut, true); 217 mutex_exit(pMtx); 205 218 setrun(pThread); 206 219 } … … 230 243 if (fHasTimeout) 231 244 { 245 ASMAtomicWritePtr(&pWait->pvMtx, pMtx); /* atomic is paranoia */ 246 232 247 if (pWait->fHighRes) 233 248 { … … 294 309 /* 295 310 * Remove the timeout callback. Drop the lock while we're doing that 296 * to reduce lock contention - we don't need it yet anyway. (Too bad we297 * are stuck with thecv_* API here, it's doing a little bit too much.)311 * to reduce lock contention / deadlocks. (Too bad we are stuck with the 312 * cv_* API here, it's doing a little bit too much.) 298 313 */ 299 314 if (fHasTimeout) 300 315 { 316 ASMAtomicWritePtr(&pWait->pvMtx, NULL); 301 317 mutex_exit(pMtx); 302 318
Note:
See TracChangeset
for help on using the changeset viewer.