userlibandfileserver/fileserver/sfat32/fat_table32.cpp
changeset 247 d8d70de2bd36
parent 109 b3a1d9898418
child 266 0008ccd16016
equal deleted inserted replaced
201:43365a9b78a3 247:d8d70de2bd36
   690     Constructor
   690     Constructor
   691 */
   691 */
   692 CAtaFatTable::CAtaFatTable(CFatMountCB& aOwner)
   692 CAtaFatTable::CAtaFatTable(CFatMountCB& aOwner)
   693              :CFatTable(aOwner), iDriveInteface(aOwner.DriveInterface())
   693              :CFatTable(aOwner), iDriveInteface(aOwner.DriveInterface())
   694     {
   694     {
   695         iState = ENotInitialised;
   695     iState = ENotInitialised;
   696     }
   696     }
   697 
   697 
   698 
   698 
   699 CAtaFatTable::~CAtaFatTable()
   699 CAtaFatTable::~CAtaFatTable()
   700     {
   700     {
  1042         if(pFatBitCache)
  1042         if(pFatBitCache)
  1043             {//-- bit cache is present, we need to populate (or repopulate it)
  1043             {//-- bit cache is present, we need to populate (or repopulate it)
  1044             //-- create helper thread object and start the thread
  1044             //-- create helper thread object and start the thread
  1045             ipHelperThread = CFat32BitCachePopulator::NewL(*this);
  1045             ipHelperThread = CFat32BitCachePopulator::NewL(*this);
  1046 
  1046 
  1047             ipHelperThread->Launch(); 
  1047             if(ipHelperThread->Launch() != KErrNone)
  1048             //-- background FAT bit cache populating thread is running now.
  1048                 {//-- failed for some reason
  1049             //-- the result of thread start up and completion isn't very interesting: If it fails to 
  1049                 DestroyHelperThread();
  1050             //-- properly populate the cache, nothing fatal will happen.
  1050                 }
       
  1051                 else
       
  1052                 {
       
  1053                 //-- background FAT bit cache populating thread is running now.
       
  1054                 //-- the result of thread start up and completion isn't very interesting: If it fails to 
       
  1055                 //-- properly populate the cache, nothing fatal will happen.
       
  1056                 }
  1051             }
  1057             }
  1052 
  1058 
  1053         //-- CFat32BitCachePopulator doesn't affect FAT table state. 
  1059         //-- CFat32BitCachePopulator doesn't affect FAT table state. 
  1054         SetState(EMounted);
  1060         SetState(EMounted);
  1055         return; 
  1061         return; 
  1542     //-- 2. create helper thread object and start the thread
  1548     //-- 2. create helper thread object and start the thread
  1543     ipHelperThread = CFat32FreeSpaceScanner::NewL(*this);
  1549     ipHelperThread = CFat32FreeSpaceScanner::NewL(*this);
  1544     
  1550     
  1545     SetState(EFreeClustersScan);
  1551     SetState(EFreeClustersScan);
  1546     
  1552     
  1547     ipHelperThread->Launch(); 
  1553     User::LeaveIfError(ipHelperThread->Launch()); 
       
  1554     
  1548     //-- background FAT scanning thread is running now
  1555     //-- background FAT scanning thread is running now
  1549     }
  1556     }
  1550 
  1557 
  1551 //-----------------------------------------------------------------------------
  1558 //-----------------------------------------------------------------------------
  1552 /**
  1559 /**
  1962         ForceStop();
  1969         ForceStop();
  1963         ASSERT(0);
  1970         ASSERT(0);
  1964         return nRes;
  1971         return nRes;
  1965         }
  1972         }
  1966 
  1973 
  1967    //-- Helper FAT thread is running now
  1974     //-- Helper FAT thread is running now
  1968    return KErrNone; 
  1975     return KErrNone; 
  1969     }
  1976     }
  1970 
  1977 
  1971 
  1978 
  1972 //#######################################################################################################################################
  1979 //#######################################################################################################################################
  1973 //#     CFat32ScanThread implementation
  1980 //#     CFat32ScanThread implementation
  1981 
  1988 
  1982 //-----------------------------------------------------------------------------
  1989 //-----------------------------------------------------------------------------
  1983 
  1990 
  1984 /**
  1991 /**
  1985     Launches the FAT32_ScanThread scaner thread.
  1992     Launches the FAT32_ScanThread scaner thread.
  1986     @return  standard error code
  1993     @return  KErrNone if the thread launched OK
       
  1994              standard error code otherwise
  1987 */
  1995 */
  1988 TInt CFat32ScanThread::Launch()
  1996 TInt CFat32ScanThread::Launch()
  1989     {
  1997     {
  1990     return DoLaunchThread(FAT32_ScanThread, this);    
  1998     return DoLaunchThread(FAT32_ScanThread, this);    
  1991     }
  1999     }