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; }
/* * 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); } }
void * MailThread::Entry() { MBusyCursor bc; //FIXME-MT: IS THIS TRUE? MailFolderCC does sufficient locking //LockFolder(); WorkFunction(); //UnLockFolder(); return NULL; // no return value }
/** * @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 ) ); }