Example #1
0
HRESULT CHttpDownloader::Load(LPCTSTR szUrl, IStream **ppStream, LPCTSTR szMD5)
{
	HRESULT hr = E_FAIL;

	m_longAbort	=	0;
	Clear();

	*ppStream = NULL;
	m_dwDownloaded = 0;
	m_dwTotalSize = 0;

	m_request.md5 = szMD5;
	hr = ParseUrl(szUrl);
	if(SUCCEEDED(hr))
	{
		if(m_pStream)
		{
			m_pStream->Release();
			m_pStream = NULL;
		}

		m_context.op = HTTP_DOWNLOADER_OP_IDLE;
		m_context.hEvent = m_hEvent;
		SetEvent(m_hEvent);

		hr = WorkFunction();
		if(SUCCEEDED(hr))
		{
			m_pStream->AddRef();
			*ppStream = m_pStream;
		}
	}
	return hr;
}
Example #2
0
/*
 * ThreadWork
 *
 * Shared work entry point by all threads.  Retrieve and perform
 * chunks of work iteratively until work is finished.
 */
static void ThreadWork(void *p){
	int work;

	while(true){
		work = GetThreadWork();
		if(work == -1)
			break;
		WorkFunction(work);
	}
}
Example #3
0
void *
MailThread::Entry()
{
   MBusyCursor bc;

   //FIXME-MT: IS THIS TRUE? MailFolderCC does sufficient locking
   //LockFolder();
   WorkFunction();
   //UnLockFolder();
   return NULL; // no return value
}
Example #4
0
/**
 * @brief Shared work entry point by all threads.  Retrieve and perform
 * chunks of work iteratively until work is finished.
 */
static int ThreadWork (void *p)
{
	while (qtrue) {
		int work = GetThreadWork();
		if (work == -1)
			break;
		WorkFunction(work);
	}

	return 0;
}
 IterationRunWork(BATB* b, const F& f) : IterationRunWork( b ) { work( WorkFunction( f ) );  }