userlibandfileserver/fileserver/sfile/sf_thread.cpp
changeset 270 ea2cef07f9fe
parent 176 af6ec97d9189
child 271 dc268b18d709
equal deleted inserted replaced
255:d45b74d3fb20 270:ea2cef07f9fe
   926 
   926 
   927 
   927 
   928 CPluginThread::CPluginThread(CFsPlugin& aPlugin, RLibrary aLibrary)
   928 CPluginThread::CPluginThread(CFsPlugin& aPlugin, RLibrary aLibrary)
   929   : iPlugin(aPlugin), iLib(aLibrary)
   929   : iPlugin(aPlugin), iLib(aLibrary)
   930 	{
   930 	{
   931 	/** @prototype */
       
   932 	iOperationLock.Close();
       
   933 	iPlugin.Open();
   931 	iPlugin.Open();
   934 	
   932 	
   935     /* 
   933 	/* 
   936     Duplicate the handle to the DLL which created the plugin to prevent 
   934 	Duplicate the handle to the DLL which created the plugin to prevent 
   937     TFsRemovePlugin::DoRequestL() from unmapping the DLL's code segment before
   935 	TFsRemovePlugin::DoRequestL() from unmapping the DLL's code segment before
   938     this thread's destructor has been called as the destructor closes the plugin 
   936 	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 (!)
   937 	which results in a call to the plugin's derived destructor contained in the DLL (!)
   940     */ 
   938 	*/ 
   941     TInt r = iLib.Duplicate(iThread, EOwnerProcess);
   939 	TInt r = iLib.Duplicate(iThread, EOwnerProcess);
   942     __ASSERT_ALWAYS(r==KErrNone, Fault(EFsThreadConstructor));
   940 	__ASSERT_ALWAYS(r==KErrNone, Fault(EFsThreadConstructor));
   943 	}
   941 	}
   944 
   942 
   945 CPluginThread::~CPluginThread()
   943 CPluginThread::~CPluginThread()
   946     {
   944 	{
   947     iPlugin.Close();
   945 	iPlugin.Close();
   948 	iLib.Close();
   946 	iLib.Close();
   949     }
   947 	iOperationLock.Close();
       
   948 	}
   950 
   949 
   951 
   950 
   952 CPluginThread* CPluginThread::NewL(CFsPlugin& aPlugin, RLibrary aLibrary)
   951 CPluginThread* CPluginThread::NewL(CFsPlugin& aPlugin, RLibrary aLibrary)
   953 	{
   952 	{
   954 	__PRINT(_L("CPluginThread::NewL()"));
   953 	__PRINT(_L("CPluginThread::NewL()"));
   955 	CPluginThread* pT=new(ELeave) CPluginThread(aPlugin, aLibrary);
   954 	CPluginThread* pT=new(ELeave) CPluginThread(aPlugin, aLibrary);
   956 	TInt r=pT->Initialise();
   955 	TInt r=pT->Initialise();
   957 
   956 
   958 	/** @prototype */
       
   959 	if(r == KErrNone)
   957 	if(r == KErrNone)
   960 		r=pT->iOperationLock.CreateLocal(0);
   958 		r=pT->iOperationLock.CreateLocal(0);
   961 
   959 
   962 	if(r!=KErrNone)
   960 	if(r!=KErrNone)
   963 		{
   961 		{