ASSERT(loc || type == ATOMIC_FENCE || type == NOOP);
Thread *t = thread ? thread : thread_current();
- this->tid = t->get_id();
+ this->tid = t!= NULL ? t->get_id() : -1;
}
typedef SnapList<uint32_t> func_id_list_t;
typedef SnapList<FuncInst *> func_inst_list_t;
-extern volatile int forklock;
+extern volatile int modellock;
#endif
*/
uint64_t ModelChecker::switch_to_master(ModelAction *act)
{
- if (forklock) {
+ if (modellock) {
static bool fork_message_printed = false;
if (!fork_message_printed) {
- model_print("Fork handler trying to call into model checker...\n");
+ model_print("Fork handler or dead thread trying to call into model checker...\n");
fork_message_printed = true;
}
delete act;
model_snapshot_space = create_mspace(numheappages * PAGESIZE, 1);
}
-volatile int forklock = 0;
+volatile int modellock = 0;
static void fork_loop() {
/* switch back here when takesnapshot is called */
pid_t forkedID;
fork_snap->currSnapShotID = snapshotid + 1;
- forklock = 1;
+ modellock = 1;
forkedID = fork();
- forklock = 0;
+ modellock = 0;
if (0 == forkedID) {
setcontext(&fork_snap->shared_ctxt);
stack_free(stack);
#ifdef TLS
if (this != model->getInitThread()) {
+ modellock = 1;
real_pthread_mutex_unlock(&mutex2);
real_pthread_join(thread, NULL);
+ modellock = 0;
}
#endif
}