diff -r 41f0cfe18c80 -r c734af59ce98 kernel/eka/drivers/locmedia/locmedia.cpp --- a/kernel/eka/drivers/locmedia/locmedia.cpp Tue Apr 27 18:02:57 2010 +0300 +++ b/kernel/eka/drivers/locmedia/locmedia.cpp Tue May 11 17:28:22 2010 +0300 @@ -3615,15 +3615,19 @@ void DPrimaryMediaBase::RequestCountInc() { __ASSERT_DEBUG(iBody, LOCM_FAULT()); - TInt oldVal = (TInt) __e32_atomic_add_ord32(&iBody->iRequestCount, (TUint) 1); -//Kern::Printf("RCINC: this %x cnt %d, old %d", this, iBody->iRequestCount, oldVal); - - OstTraceDefExt2( OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, DPRIMARYMEDIABASE_REQUESTCOUNTINC, "new count=%d; old count=%d", iBody->iRequestCount, oldVal ); - - if (oldVal == 0 && iBody->iPagingDevice) + if (iBody->iPagingDevice) { -//Kern::Printf("RCINC: NotifyBusy()"); - iBody->iPagingDevice->NotifyBusy(); + NFastMutex* lock = iBody->iPagingDevice->NotificationLock(); + NKern::FMWait(lock); + TInt oldVal = iBody->iRequestCount++; + //Kern::Printf("RCINC: this %x cnt %d, old %d", this, iBody->iRequestCount, oldVal); + OstTraceDefExt2( OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, DPRIMARYMEDIABASE_REQUESTCOUNTINC, "new count=%d; old count=%d", iBody->iRequestCount, oldVal ); + if (oldVal == 0) + { + //Kern::Printf("RCINC: NotifyBusy()"); + iBody->iPagingDevice->NotifyBusy(); + } + NKern::FMSignal(lock); } } @@ -3635,17 +3639,21 @@ void DPrimaryMediaBase::RequestCountDec() { __ASSERT_DEBUG(iBody, LOCM_FAULT()); - TInt oldVal = (TInt) __e32_atomic_add_ord32(&iBody->iRequestCount, (TUint) -1); -//Kern::Printf("RCDEC: this %x cnt %d, old %d", this, iBody->iRequestCount, oldVal); - - OstTraceDefExt2( OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, DPRIMARYMEDIABASE_REQUESTCOUNTDEC, "new count=%d; old count=%d", iBody->iRequestCount, oldVal ); - - if (oldVal == 1 && iBody->iPagingDevice) + if (iBody->iPagingDevice) { -//Kern::Printf("RCDEC: NotifyIdle()"); - iBody->iPagingDevice->NotifyIdle(); + NFastMutex* lock = iBody->iPagingDevice->NotificationLock(); + NKern::FMWait(lock); + TInt oldVal = iBody->iRequestCount--; + //Kern::Printf("RCDEC: this %x cnt %d, old %d", this, iBody->iRequestCount, oldVal); + OstTraceDefExt2( OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, DPRIMARYMEDIABASE_REQUESTCOUNTDEC, "new count=%d; old count=%d", iBody->iRequestCount, oldVal ); + if (oldVal == 1) + { + //Kern::Printf("RCDEC: NotifyIdle()"); + iBody->iPagingDevice->NotifyIdle(); + } + NKern::FMSignal(lock); + __ASSERT_DEBUG(iBody->iRequestCount >= 0, LOCM_FAULT()); } - __ASSERT_DEBUG(iBody->iRequestCount >= 0, LOCM_FAULT()); } #endif // __DEMAND_PAGING__