void finalize_helper_thread() {
Thread * curr_thread = thread_current();
- model_print("finalize_helper_thread\n");
real_pthread_mutex_lock(&curr_thread->mutex);
curr_thread->tls = (char *) get_tls_addr();
real_pthread_mutex_unlock(&curr_thread->mutex);
void * helper_thread(void * ptr) {
Thread * curr_thread = thread_current();
- model_print("helper_thread\n");
//build a context for this real thread so we can take it's context
int ret = getcontext(&curr_thread->helpercontext);
void setup_context() {
Thread * curr_thread = thread_current();
- model_print("setup_context\n");
/* Add dummy "start" action, just to create a first clock vector */
model->switch_to_master(new ModelAction(THREAD_START, std::memory_order_seq_cst, curr_thread));
/* Create the real thread */
real_pthread_create(&curr_thread->thread, NULL, helper_thread, NULL);
- model_print("thread_created\n");
bool notdone = true;
while(notdone) {
real_pthread_mutex_lock(&curr_thread->mutex);
}
set_tls_addr((uintptr_t)curr_thread->tls);
- model_print("tls taken\n");
setcontext(&curr_thread->context);
}
#endif