[prev in list] [next in list] [prev in thread] [next in thread] 

List:       helix-filesystem-cvs
Subject:    [Filesystem-cvs] local/mini minifileobj.cpp, 1.31.2.2, 1.31.2.3 minifileobj.h, 1.10, 1.10.2.1
From:       qluo () helixcommunity ! org
Date:       2013-08-08 23:35:41
[Download RAW message or body]

Update of /cvsroot/filesystem/local/mini
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv9640

Modified Files:
      Tag: hxclient_3_1_0_atlas
	minifileobj.cpp minifileobj.h 
Log Message:
add code to check recursion depth and unwindd stack using scheduler

Index: minifileobj.cpp
===================================================================
RCS file: /cvsroot/filesystem/local/mini/minifileobj.cpp,v
retrieving revision 1.31.2.2
retrieving revision 1.31.2.3
diff -u -d -r1.31.2.2 -r1.31.2.3
--- minifileobj.cpp	21 Aug 2007 05:53:18 -0000	1.31.2.2
+++ minifileobj.cpp	8 Aug 2013 23:35:33 -0000	1.31.2.3
@@ -112,10 +112,18 @@
       ,m_pDataSource         (NULL)
       ,m_bAsyncReadSupported (FALSE)
 #endif
+      ,m_ulIterationCount(0)
+      ,m_ulScheduledReadCount(0)
+      ,m_pScheduler(NULL)
 {
     DPRINTF(D_MINI_FO, ("CHXMiniFO::CHXMiniFileObject()\n"));
     m_pContext->AddRef();
 
+    if (m_pContext)
+    {
+        m_pContext->QueryInterface(IID_IHXScheduler, (void**) &m_pScheduler);
+    }
+
     m_pProtocolString = FILE_SYS_PROTOCOL;
 
     // Signify that we need to keep a reference to this object
@@ -170,6 +178,7 @@
         HX_RELEASE(m_pPendingReadBufAsync);
     }
 #endif
+    HX_RELEASE(m_pScheduler);
 }
 
 
@@ -525,6 +534,14 @@
     return result;
 }
 
+STDMETHODIMP
+CHXMiniFileObject::Func()
+{
+    UINT32 ulByteCount = m_ulScheduledReadCount;
+    m_ulScheduledReadCount = 0;
+    Read(ulByteCount);
+    return HXR_OK;
+}
 
 /****************************************************************************
  *  IHXFileObject::Read
@@ -536,6 +553,18 @@
  */
 STDMETHODIMP CHXMiniFileObject::Read( UINT32 byteCount )
 {
+    m_ulIterationCount++;
+    if (m_ulIterationCount > 200)
+    {
+        if (m_pScheduler)
+        {
+            m_ulScheduledReadCount = byteCount;
+            m_pScheduler->RelativeEnter(this, 0);
+            m_ulIterationCount--;
+            return HXR_OK;
+        }
+    }
+
     DPRINTF(D_MINI_FO, ("CHXMiniFO::Read(%u)\n", byteCount));
 
     HX_RESULT result = HXR_UNEXPECTED;
@@ -561,6 +590,7 @@
         }
     }
 
+    m_ulIterationCount--;
     return result;
 }
 

Index: minifileobj.h
===================================================================
RCS file: /cvsroot/filesystem/local/mini/minifileobj.h,v
retrieving revision 1.10
retrieving revision 1.10.2.1
diff -u -d -r1.10 -r1.10.2.1
--- minifileobj.h	19 Jul 2007 00:37:01 -0000	1.10
+++ minifileobj.h	8 Aug 2013 23:35:33 -0000	1.10.2.1
@@ -79,6 +79,7 @@
 			   public IHXRequestHandler,
 			   public IHXFileExists,
 			   public IHXFileStat,
+                           public IHXCallback,
 			   public IHXGetFileFromSamePool
 #if defined(HELIX_FEATURE_MMF_DATASOURCE)			   
 			  ,public IHXMMFDataSourceObserver
@@ -153,6 +154,11 @@
      *  IHXGetFileFromSamePool Interface Methods
      */
     STDMETHOD(GetFileObjectFromPool) (THIS_ IHXGetFileFromSamePoolResponse* response);
+
+    /************************************************************************
+     *  IHXCallback Interface Methods 
+     */
+    STDMETHOD(Func)     (THIS);
     
 #if defined(HELIX_FEATURE_MMF_DATASOURCE)
     /************************************************************************
@@ -163,6 +169,10 @@
 
 protected:
 
+    UINT32                  m_ulIterationCount;
+    UINT32                  m_ulScheduledReadCount;
+    IHXScheduler*           m_pScheduler;
+
     /****** Protected Class Variables ****************************************/
     INT32                   m_RefCount;       // Object's reference count
     IHXCommonClassFactory*  m_pClassFactory;  // Creates common classes


_______________________________________________
Filesystem-cvs mailing list
Filesystem-cvs@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/filesystem-cvs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic