Example #1
0
bool HttpRequest::Init(int nWorker)
{
	m_bStop = false;
	m_nWorker = nWorker;
	m_nReqIndex = 0;

	CURLcode res = curl_global_init(CURL_GLOBAL_DEFAULT);
	if (res != CURLE_OK) 
	{
		XLog(LEVEL_ERROR, "Init curl fail:%s\n", curl_easy_strerror(res));
		return false;
	}

	for (int i = 0; i < m_nWorker; i++)
	{
		XThread* poThread = new XThread();
		if (!poThread->Create(HttpRequest::WorkThread, this, false))
		{
			XLog(LEVEL_ERROR, "Create thread fail\n");
			SAFE_DELETE(poThread);
			return false;
		}
		m_oVecThread.push_back(poThread);
	}
	return true;
}
Example #2
0
void *XThread::_run(void *threadData)
{

  // get thread data from args

  XThread *thread = (XThread *) threadData;
  assert(thread);
  return thread->_run();

}
Example #3
0
int main(int argc, char** argv) {
	LOG("ARGC=%d\n", argc);
	VcManager::init(IP, 4525, 2);
	VcManager::get()->addFriend(1, IP, 4523);

	XThread *xt = new XThread();
	xt->setRunnable(&pushFrame);
	xt->start();

	Callback cb;
	VcManager::get()->setCallback(&cb);
	sleep(1);
	VcManager::get()->makeCall(1);
	sleep(1000);
	VcManager::get()->deinit();
	return 0;
}
bool theremax_cv_thread_start( )
{
    theremaxCV.process();
    thread.start(threadfunc);
    return 1;
};