genericopenlibs/openenvcore/backend/src/corebackend/localif.cpp
branchGCC_SURGE
changeset 45 4b03adbd26ca
parent 39 4393da0c39b5
parent 34 5fae379060a7
child 47 d7383dba13ba
equal deleted inserted replaced
42:a16d1cd191f6 45:4b03adbd26ca
   181 		if (err)
   181 		if (err)
   182 			{
   182 			{
   183 			User::Panic(KEstlibInit, err);
   183 			User::Panic(KEstlibInit, err);
   184 			}
   184 			}
   185 
   185 
   186 		iCleanup.StorePtrs(iPrivateHeap, &iFs, &iSs, &iCs, &iSSLock, &iCSLock, &iTzServer);
   186 		iCleanup.StorePtrs(iPrivateHeap, &iFs, &iSs, &iCs, &iSSLock, &iCSLock);
   187 		
   187 		
   188 		// No connection settings by default
   188 		// No connection settings by default
   189 		iDefConnPref = NULL;
   189 		iDefConnPref = NULL;
   190 		}
   190 		}
   191 
   191 
   198 	iSessionPathLock.Close();
   198 	iSessionPathLock.Close();
   199 	// Close the aselect lock
   199 	// Close the aselect lock
   200 	iASelectLock.Close();
   200 	iASelectLock.Close();
   201 	// Close the default connection lock
   201 	// Close the default connection lock
   202 	iDefConnLock.Close();
   202 	iDefConnLock.Close();
       
   203 	
   203 	//close the default RConnection
   204 	//close the default RConnection
   204 	if(iDefConnection.SubSessionHandle() != 0)
   205 	if(iDefConnection.SubSessionHandle() != 0)
       
   206 	    {
   205 		iDefConnection.Close();
   207 		iDefConnection.Close();
       
   208 	    }
   206 
   209 
   207 	RHeap* oHeap = User::SwitchHeap(iPrivateHeap);
   210 	RHeap* oHeap = User::SwitchHeap(iPrivateHeap);
   208 	for (TInt i = 0, count = iTLDInfoList.Count(); i < count; i++ )
   211 	for (TInt i = 0, count = iTLDInfoList.Count(); i < count; i++ )
   209 		{
   212 		{
   210 		iTLDInfoList[i].Close(iPrivateHeap);
   213 		iTLDInfoList[i].Close(iPrivateHeap);
   214 	iTLDInfoList.Close();
   217 	iTLDInfoList.Close();
   215 	// Cleanup the threads serving aselect requests
   218 	// Cleanup the threads serving aselect requests
   216 	int err;
   219 	int err;
   217 	// passing 1 to cancelaselect will kill all the threads serving aselect
   220 	// passing 1 to cancelaselect will kill all the threads serving aselect
   218 	cancelaselect(NULL,err,1);
   221 	cancelaselect(NULL,err,1);
   219 	// Switch to backend heap
   222 
   220 	RHeap* oldHeap = User::SwitchHeap(iPrivateHeap);
       
   221 	// Close the array that maintains aselect request details 
   223 	// Close the array that maintains aselect request details 
   222 	iASelectRequest.Close();
   224 	iASelectRequest.Close();
   223 	//close the RTz server
   225 	//close the RTz connection
   224 	iTzServer.Close();
   226 	iTzServer.Close();
   225 	// Switch back to old heap
   227 
   226 	User::SwitchHeap(oldHeap);
       
   227 
   228 
   228 	if( iDefConnPref )
   229 	if( iDefConnPref )
   229 	    {
   230 	    {
   230 	    switch( iDefConnPref->ExtensionId() )
   231 	    switch( iDefConnPref->ExtensionId() )
   231 	        {
   232 	        {
   255 	            }
   256 	            }
   256 	        }
   257 	        }
   257 	    }
   258 	    }
   258 
   259 
   259 #if (defined SYMBIAN_OE_POSIX_SIGNALS && defined SYMBIAN_OE_LIBRT)
   260 #if (defined SYMBIAN_OE_POSIX_SIGNALS && defined SYMBIAN_OE_LIBRT)
   260 	iTimerOverrunsMutex.Close();
   261 	iTimerOverrunsMutex.Close();	
   261 	iTimerOverruns.Close(); 
   262 	iTimerOverruns.Close(); 
   262 #endif	
   263 #endif	
       
   264 	
       
   265 #if (defined SYMBIAN_OE_POSIX_SIGNALS)
       
   266 	iSigInitWaitMutex.Close();
       
   267 	iSigInitWaitSemaphore.Close();
       
   268 	iBlockedSAMutex.Close();
       
   269 	iSignalWaiterMutex.Close();
       
   270 	iSignalInitSemaphore.Close();
       
   271 #endif
   263 	//close the RpointerArray
   272 	//close the RpointerArray
   264 	iOpenDirList.Close();
   273 	iOpenDirList.Close();
       
   274 	
       
   275 	iSSLock.Close();
       
   276 	iCSLock.Close();
       
   277 	iSignalSession.Close();
       
   278 	iIpcS.Close();
       
   279 		
   265 	User::SwitchHeap(oHeap);
   280 	User::SwitchHeap(oHeap);
   266 	}
   281 	}
   267 
   282 
   268 #ifdef __SYMBIAN_COMPILE_UNUSED__
   283 #ifdef __SYMBIAN_COMPILE_UNUSED__
   269 CLocalSystemInterface& CLocalSystemInterface::Clone()
   284 CLocalSystemInterface& CLocalSystemInterface::Clone()
   298 // -----------------------------------------------------------------------------
   313 // -----------------------------------------------------------------------------
   299 //
   314 //
   300 void CLocalSystemInterface::Exit(int code)
   315 void CLocalSystemInterface::Exit(int code)
   301 	{
   316 	{
   302 #ifdef SYMBIAN_OE_POSIX_SIGNALS
   317 #ifdef SYMBIAN_OE_POSIX_SIGNALS
   303     TRequestStatus status = KRequestPending;
   318     if(iSignalsInitialized)
   304     iSignalHandlerThread.Logon(status);
   319         {
   305 	iSignalLoopRunning = EFalse;
   320         TRequestStatus status = KRequestPending;
   306 	iSignalHandlerThread.RequestSignal();
   321         iSignalHandlerThread.Logon(status);
   307 	User::WaitForRequest(status);
   322         iSignalLoopRunning = EFalse;
       
   323         iSignalHandlerThread.RequestSignal();
       
   324         User::WaitForRequest(status);
       
   325         }
   308 #endif
   326 #endif
   309 	iFids.Close();
   327 	iFids.Close();
   310 	User::SetCritical(User::EProcessPermanent);
   328 	User::SetCritical(User::EProcessPermanent);
   311 	User::Exit(code);
   329 	User::Exit(code);
   312 	}
   330 	}
   332 	{
   350 	{
   333 	return PosixFilesystem::mkdir(iFs, aPath, perms, anErrno);
   351 	return PosixFilesystem::mkdir(iFs, aPath, perms, anErrno);
   334 	}
   352 	}
   335 
   353 
   336 int CLocalSystemInterface::stat (const wchar_t* name, struct stat *st, int& anErrno)
   354 int CLocalSystemInterface::stat (const wchar_t* name, struct stat *st, int& anErrno)
   337     {
   355     {    
   338     const wchar_t* filename;
   356     const wchar_t* filename  = name;
   339     // This needs to be zero terminated
   357     // This needs to be zero terminated
   340     TBuf<KMaxFileName> inputName;
   358     TBuf<KMaxFileName> inputName;
   341     TUint pathAtt = 0;
   359     TUint pathAtt = 0;
   342     TInt err = GetFullFile(inputName,(const TText16*)name,iFs);
   360     TInt err = GetFullFile(inputName,(const TText16*)name,iFs);
   343     if( !err )
   361     if( !err )
  3207 #ifdef SYMBIAN_OE_LIBRT
  3225 #ifdef SYMBIAN_OE_LIBRT
  3208 // -----------------------------------------------------------------------------
  3226 // -----------------------------------------------------------------------------
  3209 // CLocalSystemInterface::FindTimer
  3227 // CLocalSystemInterface::FindTimer
  3210 // -----------------------------------------------------------------------------
  3228 // -----------------------------------------------------------------------------
  3211 //
  3229 //
  3212 TInt CLocalSystemInterface::FindTimer(const TInt& aTimerId) 
  3230 EXPORT_C TInt CLocalSystemInterface::FindTimer(const TInt& aTimerId) 
  3213 	{
  3231 	{
  3214 	iTimerOverrunsMutex.Wait();
  3232 	iTimerOverrunsMutex.Wait();
  3215 
  3233 
  3216 	TInt lIndex = KErrNotFound;
  3234 	TInt lIndex = KErrNotFound;
  3217 	TInt lTimerCnt = iTimerOverruns.Count();
  3235 	TInt lTimerCnt = iTimerOverruns.Count();