Lock model check when we terminate proxy thread
[c11tester.git] / snapshot.cc
index c24e5ec54097d876851b32e681f8334621afd165..dab1a480d5910d84ed97ec2782e6fa73d7e50a85 100644 (file)
@@ -375,18 +375,23 @@ static void fork_snapshot_init(unsigned int numbackingpages,
        model_snapshot_space = create_mspace(numheappages * PAGESIZE, 1);
 }
 
+volatile int modellock = 0;
+
 static void fork_loop() {
        /* switch back here when takesnapshot is called */
        snapshotid = fork_snap->currSnapShotID;
        if (model->params.nofork) {
                setcontext(&fork_snap->shared_ctxt);
-               exit(EXIT_SUCCESS);
+               _Exit(EXIT_SUCCESS);
        }
 
        while (true) {
                pid_t forkedID;
                fork_snap->currSnapShotID = snapshotid + 1;
+
+               modellock = 1;
                forkedID = fork();
+               modellock = 0;
 
                if (0 == forkedID) {
                        setcontext(&fork_snap->shared_ctxt);
@@ -403,7 +408,7 @@ static void fork_loop() {
                        }
 
                        if (fork_snap->mIDToRollback != snapshotid)
-                               exit(EXIT_SUCCESS);
+                               _Exit(EXIT_SUCCESS);
                }
        }
 }