userlibandfileserver/fileserver/sfile/sf_file.cpp
changeset 273 6a75fa55495f
parent 244 a77889bee936
child 286 48e57fb1237e
equal deleted inserted replaced
271:dc268b18d709 273:6a75fa55495f
  2770 	iFile->DemoteShare(this);
  2770 	iFile->DemoteShare(this);
  2771 	iFile->CancelAsyncReadRequest(this, NULL);
  2771 	iFile->CancelAsyncReadRequest(this, NULL);
  2772 	iFile->Close();
  2772 	iFile->Close();
  2773 	}
  2773 	}
  2774 
  2774 
       
  2775 void CFileShare::Close()
       
  2776 	{
       
  2777 	
       
  2778 	// Flush the write cache before closing the file share
       
  2779 	// NB If there is any dirty data, then a new request will be allocated which will increase
       
  2780 	// the reference count on this file share, thus preventing it from being deleted untill all 
       
  2781 	// data has been flushed
       
  2782 	if (AccessCount() == 1)
       
  2783 		{
       
  2784 		CFileCache* fileCache = File().FileCache();
       
  2785 		if (fileCache)
       
  2786 			fileCache->FlushDirty();
       
  2787 		}
       
  2788 
       
  2789 	CFsDispatchObject::Close();
       
  2790 	}
       
  2791 
       
  2792 
  2775 /**
  2793 /**
  2776 Check that the media is still mounted.
  2794 Check that the media is still mounted.
  2777 
  2795 
  2778 @return KErrNone if successful.
  2796 @return KErrNone if successful.
  2779         KErrDisMounted if media has dismounted.
  2797         KErrDisMounted if media has dismounted.