Retail products


Traffic interception SDK

Control every TCP/IP network connection

  • Route connections via proxy
  • Redirect connections and modify the data
  • Block connections and applications
SSL interception SDK

View SSL in plaintext and modify it

  • View the SSL stream decrypted in plaintext
  • Redirect SSL connection and modify decrypted data
  • Browser shows "SSL lock" without warnings

Documentation


CThreadPoolManager Class Reference

#include <ThreadPool.h>

Collaboration diagram for CThreadPoolManager:

List of all members.


Public Member Functions

CThreadPoolGetPool (DWORD dwThreads)
void ReleasePool (CThreadPool *pPool)
void ReleasePool (CThreadPool **ppPool)
 CThreadPoolManager ()
virtual ~CThreadPoolManager ()

Static Public Member Functions

static CThreadPoolManagerGetInstance ()

Detailed Description

Definition at line 257 of file ThreadPool.h.


Constructor & Destructor Documentation

CThreadPoolManager::CThreadPoolManager (  ) 

Definition at line 60 of file ThreadPool.cpp.

00061 {
00062     //Create the CS
00063     m_pCS=COSManager::CreateCriticalSection();
00064 }

CThreadPoolManager::~CThreadPoolManager (  )  [virtual]

Definition at line 66 of file ThreadPool.cpp.

00067 {
00068     //Release the CS
00069     delete m_pCS;
00070 }


Member Function Documentation

CThreadPoolManager & CThreadPoolManager::GetInstance (  )  [static]

Definition at line 180 of file ThreadPool.cpp.

00181 {
00182     return m_aInstance;
00183 }

CThreadPool * CThreadPoolManager::GetPool ( DWORD  dwThreads  ) 

Definition at line 72 of file ThreadPool.cpp.

00073 {
00074     //Lock the CS
00075     CCriticalAutoRelease aRelease(m_pCS);
00076 
00077     //Look for a pool
00078     PoolMap::iterator aIterator;
00079     aIterator=m_aData.find(dwThreads);
00080 
00081     //Did we get it?
00082     if (aIterator==m_aData.end())
00083     {
00084         //Exit the CS
00085         aRelease.Exit();
00086 
00087         //Create a new pool
00088         return new CThreadPool(dwThreads);
00089     }
00090     else
00091     {
00092         //Get the pool
00093         CThreadPool* pPool;
00094         pPool=aIterator->second;
00095 
00096         //Delete tit
00097         m_aData.erase(aIterator);
00098 
00099         //Exit the CS
00100         aRelease.Exit();
00101 
00102         //Clean the pool
00103         pPool->Clear();
00104 
00105         //Done
00106         return pPool;
00107     }
00108 }

void CThreadPoolManager::ReleasePool ( CThreadPool **  ppPool  ) 

Definition at line 110 of file ThreadPool.cpp.

00111 {
00112     //Sanity check
00113     if (!ppPool ||
00114         !*ppPool)
00115         return;
00116 
00117     //Get the var
00118     CThreadPool* pTmp;
00119     pTmp=*ppPool;
00120     *ppPool=NULL;
00121 
00122     //And release
00123     ReleasePool(pTmp);
00124 }

void CThreadPoolManager::ReleasePool ( CThreadPool pPool  ) 

Definition at line 126 of file ThreadPool.cpp.

00127 {
00128     //Sanity check
00129     if (!pPool)
00130         return;
00131 
00132     //Clear the jobs
00133     pPool->Clear();
00134 
00135     //The timeout
00136     DWORD dwTimeout;
00137     dwTimeout=pPool->GetTimeout();
00138     if (!dwTimeout)
00139         dwTimeout=10000;
00140 
00141     //Wait for the jobs to finish
00142     DWORD dwTick;
00143     dwTick=GetTickCount();
00144 
00145     //Start to wait
00146     while (1)
00147     {
00148         //Do we have threads?
00149         if (!pPool->GetRunningThreads())
00150             break;
00151 
00152         //Do we need to exit
00153         if (GetTickCount()-dwTick>=dwTimeout)
00154             break;
00155 
00156         //Sleep a bit
00157         Sleep(50);
00158     }
00159 
00160     //Why did we exit?
00161     if (pPool->GetRunningThreads())
00162     {
00163         //We need to get rid of this pool
00164         pPool->SetTimeout(0);
00165 
00166         //Delete it
00167         delete pPool;
00168 
00169         //Done
00170         return;
00171     }
00172 
00173     //Lock the CS
00174     CCriticalAutoRelease aRelease(m_pCS);
00175 
00176     //Insert it
00177     m_aData.insert(PoolMap::value_type(pPool->GetMaxThreads(),pPool));
00178 }


The documentation for this class was generated from the following files: