produce:
for(int i=0;i<m_push_thread;i++){
if(iter == VecS2SResult.end()){break;
}
if(g_Empty_sem_obj[i].sem_trywait()==0){
//获取到信号量
g_push_consume_cache[i].msgid = (*iter)["FmsgId"];
g_push_consume_cache[i].appid = (*iter)["Fappid"];
iter = VecS2SResult.erase(iter);
g_Full_sem_obj[i].sem_post();
}
}
consume:
while(1){
//等待信号量
g_Full_sem_obj[threadId].sem_wait();
do_something();
g_Empty_sem_obj[threadId].sem_post();
}