model->switch_to_master(new ModelAction(THREAD_START, std::memory_order_seq_cst, curr_thread));
/* Call the actual thread function */
- curr_thread->start_routine(curr_thread->arg);
+ if (curr_thread->start_routine != NULL) {
+ curr_thread->start_routine(curr_thread->arg);
+ } else if (curr_thread->pstart_routine != NULL) {
+ curr_thread->pstart_routine(curr_thread->arg);
+ }
/* Finish thread properly */
model->switch_to_master(new ModelAction(THREAD_FINISH, std::memory_order_seq_cst, curr_thread));
}
creation(NULL),
pending(NULL),
start_routine(func),
+ pstart_routine(NULL),
arg(a),
user_thread(t),
id(tid),
if (ret)
model_print("Error in create_context\n");
- // user_thread->priv = this; // WL
+ user_thread->priv = this; // WL
}
/**
if (pending->get_type() == THREAD_JOIN)
return pending->get_thread_operand();
- else if (pending->get_type() == PTHREAD_JOIN) {
- // WL: to be added
- }
+ else if (pending->get_type() == PTHREAD_JOIN)
+ return pending->get_thread_operand();
else if (pending->is_lock())
return (Thread *)pending->get_mutex()->get_state()->locked;
return NULL;