void a::create()

{

Function *f1 = m_functionmanager.CreateFunction(1);
Function *f2 = m_functionmanager.CreateFunction(2);

vec.push_back(f1);

vec.push_back(f2);

}

void a::createthread()

{

for(int i=0;i<vec.size();i++)

{

this->buildthread(vec[i]);

}

}

void a::buildthread(Function* m_function)

{

pthread_t p;

pthread_create(&p,NULL,buildwork,(void*)m_function);

pthread_detach(p);

}

void a::buildword(void*p)

{

if(p==NULL)

{

pthread_exit(NULL);

}

while(true)

{

Function *worker=static_case<Function*>(p);

worker->Work();

}

pthread_exit(NULL);

}

posted on 2017-05-17 20:48  baraka  阅读(434)  评论(0编辑  收藏  举报