Lock model check when we terminate proxy thread
[c11tester.git] / snapshot.cc
index dc42614efd8f89d7f6fb6360132afb2fe7410c5b..dab1a480d5910d84ed97ec2782e6fa73d7e50a85 100644 (file)
@@ -375,6 +375,8 @@ 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;
@@ -386,7 +388,10 @@ static void fork_loop() {
        while (true) {
                pid_t forkedID;
                fork_snap->currSnapShotID = snapshotid + 1;
+
+               modellock = 1;
                forkedID = fork();
+               modellock = 0;
 
                if (0 == forkedID) {
                        setcontext(&fork_snap->shared_ctxt);