예제 #1
0
파일: llcurl.cpp 프로젝트: HizWylder/GIS
// Note: call once per frame
S32 LLCurlRequest::process()
{
	S32 res = 0;

	mProcessing = TRUE;
	for (curlmulti_set_t::iterator iter = mMultiSet.begin();
		 iter != mMultiSet.end(); )
	{
		curlmulti_set_t::iterator curiter = iter++;
		LLCurl::Multi* multi = *curiter;

		if(!multi->isValid())
		{
			if(multi == mActiveMulti)
			{				
				mActiveMulti = NULL ;
				mActiveRequestCount = 0 ;
			}
			mMultiSet.erase(curiter) ;
			LLCurl::getCurlThread()->killMulti(multi) ;
			continue ;
		}

		S32 tres = multi->process();
		res += tres;
		if (multi != mActiveMulti && tres == 0 && multi->mQueued == 0)
		{
			mMultiSet.erase(curiter);
			LLCurl::getCurlThread()->killMulti(multi);
		}
	}
	mProcessing = FALSE;
	return res;
}
예제 #2
0
파일: llcurl.cpp 프로젝트: HizWylder/GIS
S32 LLCurlRequest::getQueued()
{
	S32 queued = 0;
	for (curlmulti_set_t::iterator iter = mMultiSet.begin();
		 iter != mMultiSet.end(); )
	{
		curlmulti_set_t::iterator curiter = iter++;
		LLCurl::Multi* multi = *curiter;
		
		if(!multi->isValid())
		{
			if(multi == mActiveMulti)
			{				
				mActiveMulti = NULL ;
				mActiveRequestCount = 0 ;
			}
			LLCurl::getCurlThread()->killMulti(multi);
			mMultiSet.erase(curiter) ;
			continue ;
		}

		queued += multi->mQueued;
		if (multi->getState() != LLCurl::Multi::STATE_READY)
		{
			++queued;
		}
	}
	return queued;
}
예제 #3
0
LLCurlRequest::~LLCurlRequest()
{
	llassert_always(mThreadID == LLThread::currentID());

	//stop all Multi handle background threads
	for (curlmulti_set_t::iterator iter = mMultiSet.begin(); iter != mMultiSet.end(); ++iter)
	{
		LLCurl::Multi* multi = *iter;
		if (multi->mThreaded)
			multi->mSignal->lock();
		multi->mQuitting = true;
		if (multi->mThreaded)
		{
			while (!multi->isStopped())
			{
				multi->mSignal->signal();
				multi->mSignal->unlock();
				apr_sleep(1000);
				multi->mSignal->lock();
			}
		}
		if (multi->mThreaded)
			multi->mSignal->unlock();
	}
	for_each(mMultiSet.begin(), mMultiSet.end(), DeletePointer());
}
예제 #4
0
void LLCurlRequest::addMulti()
{
	llassert_always(mThreadID == LLThread::currentID());
	LLCurl::Multi* multi = new LLCurl::Multi();
	if (multi->mThreaded)
	{
		multi->start();
	}
	mMultiSet.insert(multi);
	mActiveMulti = multi;
	mActiveRequestCount = 0;
}
예제 #5
0
파일: llcurl.cpp 프로젝트: HizWylder/GIS
void LLCurlRequest::addMulti()
{
	LLCurl::Multi* multi = new LLCurl::Multi();
	if(!multi->isValid())
	{
		LLCurl::getCurlThread()->killMulti(multi) ;
		mActiveMulti = NULL ;
		mActiveRequestCount = 0 ;
		return;
	}

	mMultiSet.insert(multi);
	mActiveMulti = multi;
	mActiveRequestCount = 0;
}
예제 #6
0
파일: llcurl.cpp 프로젝트: Boy/rainbow
// Note: call once per frame
S32 LLCurlRequest::process()
{
	S32 res = 0;
	for (curlmulti_set_t::iterator iter = mMultiSet.begin();
		 iter != mMultiSet.end(); )
	{
		curlmulti_set_t::iterator curiter = iter++;
		LLCurl::Multi* multi = *curiter;
		S32 tres = multi->process();
		res += tres;
		if (multi != mActiveMulti && tres == 0 && multi->mQueued == 0)
		{
			mMultiSet.erase(curiter);
			delete multi;
		}
	}
	return res;
}
예제 #7
0
// Note: call once per frame
S32 LLCurlRequest::process()
{
	llassert_always(mThreadID == LLThread::currentID());
	S32 res = 0;

	mProcessing = TRUE;
	for (curlmulti_set_t::iterator iter = mMultiSet.begin();
		 iter != mMultiSet.end(); )
	{
		curlmulti_set_t::iterator curiter = iter++;
		LLCurl::Multi* multi = *curiter;
		S32 tres = multi->process();
		res += tres;
		if (multi != mActiveMulti && tres == 0 && multi->mQueued == 0)
		{
			mMultiSet.erase(curiter);
			if (multi->mThreaded)
				multi->mSignal->lock();
			multi->mQuitting = true;
			if (multi->mThreaded)
			{
				while (!multi->isStopped())
				{
					multi->mSignal->signal();
					multi->mSignal->unlock();
					apr_sleep(1000);
					multi->mSignal->unlock();
				}
			}
			if (multi->mThreaded)
				multi->mSignal->unlock();

			delete multi;
		}
	}
	mProcessing = FALSE;
	return res;
}