userlibandfileserver/fileserver/sfile/sf_thread.cpp
branchGCC_SURGE
changeset 221 39b39e1a406e
parent 167 b41fc9c39ca7
parent 201 43365a9b78a3
equal deleted inserted replaced
219:0ff03867bdb6 221:39b39e1a406e
   832 // return if request's session has notify user set
   832 // return if request's session has notify user set
   833 // must be called from drive thread and request have a session set
   833 // must be called from drive thread and request have a session set
   834 //
   834 //
   835 	{
   835 	{
   836 	__ASSERT_ALWAYS(FsThreadManager::IsDriveThread(iDriveNumber,EFalse),Fault(EDriveThreadNotifyUser1));
   836 	__ASSERT_ALWAYS(FsThreadManager::IsDriveThread(iDriveNumber,EFalse),Fault(EDriveThreadNotifyUser1));
   837 	// NB For read-ahead or a flush-dirty write request generated by the file cache, the session will be NULL: 
   837 	// NB For read-ahead or a flush-dirty write request generated by the file cache, the request or the session may be NULL: 
   838 	// in this case assume that notify user is set (as it's the safest option)
   838 	// in this case assume that notify user is set (as it's the safest option)
   839 	CSessionFs* session = iRequest->Session();
   839 	return iRequest && iRequest->Session() ?  iRequest->Session()->GetNotifyUser() : ETrue;
   840 	return session ?  session->GetNotifyUser() : ETrue;
       
   841 	}
   840 	}
   842 
   841 
   843 void CDriveThread::StartFinalisationTimer()
   842 void CDriveThread::StartFinalisationTimer()
   844 	{
   843 	{
   845 	if(IsProxyDrive(iDriveNumber))
   844 	if(IsProxyDrive(iDriveNumber))
   924 	TUint id=t.Id();
   923 	TUint id=t.Id();
   925 	return(id);
   924 	return(id);
   926 	}
   925 	}
   927 
   926 
   928 
   927 
   929 CPluginThread::CPluginThread(CFsPlugin& aPlugin)
   928 CPluginThread::CPluginThread(CFsPlugin& aPlugin, RLibrary aLibrary)
   930   : iPlugin(aPlugin)
   929   : iPlugin(aPlugin), iLib(aLibrary)
   931 	{
   930 	{
   932 	/** @prototype */
   931 	/** @prototype */
   933 	iOperationLock.Close();
   932 	iOperationLock.Close();
   934 	iPlugin.Open();
   933 	iPlugin.Open();
       
   934 	
       
   935     /* 
       
   936     Duplicate the handle to the DLL which created the plugin to prevent 
       
   937     TFsRemovePlugin::DoRequestL() from unmapping the DLL's code segment before
       
   938     this thread's destructor has been called as the destructor closes the plugin 
       
   939     which results in a call to the plugin's derived destructor contained in the DLL (!)
       
   940     */ 
       
   941     TInt r = iLib.Duplicate(iThread, EOwnerProcess);
       
   942     __ASSERT_ALWAYS(r==KErrNone, Fault(EFsThreadConstructor));
   935 	}
   943 	}
   936 
   944 
   937 CPluginThread::~CPluginThread()
   945 CPluginThread::~CPluginThread()
   938     {
   946     {
   939     iPlugin.Close();
   947     iPlugin.Close();
       
   948 	iLib.Close();
   940     }
   949     }
   941 
   950 
   942 
   951 
   943 CPluginThread* CPluginThread::NewL(CFsPlugin& aPlugin)
   952 CPluginThread* CPluginThread::NewL(CFsPlugin& aPlugin, RLibrary aLibrary)
   944 	{
   953 	{
   945 	__PRINT(_L("CPluginThread::NewL()"));
   954 	__PRINT(_L("CPluginThread::NewL()"));
   946 	CPluginThread* pT=new(ELeave) CPluginThread(aPlugin);
   955 	CPluginThread* pT=new(ELeave) CPluginThread(aPlugin, aLibrary);
   947 	TInt r=pT->Initialise();
   956 	TInt r=pT->Initialise();
   948 
   957 
   949 	/** @prototype */
   958 	/** @prototype */
   950 	if(r == KErrNone)
   959 	if(r == KErrNone)
   951 		r=pT->iOperationLock.CreateLocal(0);
   960 		r=pT->iOperationLock.CreateLocal(0);