本文整理汇总了C++中TaskQueue::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ TaskQueue::begin方法的具体用法?C++ TaskQueue::begin怎么用?C++ TaskQueue::begin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TaskQueue
的用法示例。
在下文中一共展示了TaskQueue::begin方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: check_wait_queue
void* check_wait_queue(void* args) {
Worker *worker = (Worker*) args;
TaskQueue_Item *qi;
while (ON) {
while (wqueue.size() > 0) {
//for(TaskQueue::iterator it = wqueue.begin(); it != wqueue.end(); ++it) {
int size = wqueue.size();
for (int i = 0; i < size; i++) {
//qi = *it;
qi = wqueue[i];
if (qi != NULL) {
int status = worker->check_if_task_is_ready(qi->task_id); //cout << "task = " << qi->task_id << " status = " << status << endl;
if (status == 0) {
//cout << "task = " << qi->task_id << " status = " << status << endl;
int ret = worker->move_task_to_ready_queue(&qi);
pthread_mutex_lock(&w_lock);
wqueue[i] = NULL;
pthread_mutex_unlock(&w_lock);
}
/*if(status < 0) {
cout << "negative numwait" << endl;
}*/
}
}
pthread_mutex_lock(&w_lock);
TaskQueue::iterator last = remove_if(wqueue.begin(), wqueue.end(),
check);
wqueue.erase(last, wqueue.end());
pthread_mutex_unlock(&w_lock);
sleep(1);
}
}
}
示例2: str
map<uint32_t, NodeList> Worker::get_map(TaskQueue &mqueue) {
map<uint32_t, NodeList> update_map;
/*Package package;
package.set_operation(operation);
if(operation == 25) {
package.set_currnode(toid);
}*/
uint32_t num_nodes = svrclient.memberList.size();
for (TaskQueue::iterator it = mqueue.begin(); it != mqueue.end(); ++it) {
uint32_t serverid = myhash(((*it)->task_id).c_str(), num_nodes);
string str((*it)->task_id);
str.append("\'");
if (update_map.find(serverid) == update_map.end()) {
str.append("\"");
NodeList new_list;
new_list.push_back(str);
update_map.insert(make_pair(serverid, new_list));
} else {
NodeList &exist_list = update_map[serverid];
string last_str(exist_list.back());
if ((last_str.size() + str.size()) > STRING_THRESHOLD) {
str.append("\"");
exist_list.push_back(str);
} else {
exist_list.pop_back();
str.append(last_str);
exist_list.push_back(str);
}
}
}
return update_map;
}
示例3: updateFramesClass
void TaskScheduler::updateFramesClass(TaskQueue& queue, Class* klass)
{
for(TaskQueue::iterator it = queue.begin(); it != queue.end(); it++)
{
Task* task = *it;
task->getContext()->updateFramesClass(klass);
}
}