本文整理汇总了C++中map::get方法的典型用法代码示例。如果您正苦于以下问题:C++ map::get方法的具体用法?C++ map::get怎么用?C++ map::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类map
的用法示例。
在下文中一共展示了map::get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mutex_lock_validity
bool mutex_lock_validity(pthread_mutex_t* arg)
{
pthread_t holding_thread = lock_map.get(arg);
if(holding_thread==NULL) {
return true;
}
else { // Do something if other thread is holding lock
struct thread_data* cur_thread_data=all_thread.get(pthread_self());
cur_thread_data->state=PTHREAD_WAITING_THREAD;
cur_thread_data->waiting_lock=arg;
return false;
}
}
示例2: closure_wrapper
void* closure_wrapper(void* arg) {
struct Thread_Arg* th_arg=(struct Thread_Arg*)arg;
original_pthread_mutex_lock(&SCHED_LOCK);
PRINT("NEW THREAD %lx BEGINS\n",pthread_self());
void* ret=th_arg->start_routine(th_arg->arg);
//free(th_arg);
struct thread_data* cur_thread_data=(struct thread_data*)all_thread.get(pthread_self());
ASSERT((cur_thread_data==NULL),"SNAP!!");
cur_thread_data->state=PTHREAD_DEAD_THREAD;
findnextthreadtoschedule(NULL);
original_pthread_mutex_unlock(&SCHED_LOCK);
PRINT("EXITING THREAD %x\n",pthread_self());
return(ret);
}
示例3: pthread_join
int pthread_join(pthread_t joinee, void **retval)
{
PRINT("THREAD JOIN\n",NULL);
// TODO
struct thread_data* join_thread_data=all_thread.get(joinee);
// cur_thread_data->state=PTHREAD_WAITING_THREAD;
while(join_thread_data->state!=PTHREAD_DEAD_THREAD) {
next_thread=joinee;
sched();
}
//original_pthread_mutex_unlock(&SCHED_LOCK);
return original_pthread_join(joinee, retval);
//original_pthread_mutex_lock(&SCHED_LOCK);
//cur_thread_data->state=PTHREAD_ACTIVE_THREAD;
//findnextthreadtoschedule(NULL);
//sched();
}