00001 00002 #include "pose.h" 00003 00005 void adapt2::Step() 00006 { 00007 Event *ev; 00008 POSE_TimeType lastGVT = localPVT->getGVT(); 00009 int iter=0; 00010 00011 rbFlag = 0; 00012 if (!parent->cancels.IsEmpty()) CancelUnexecutedEvents(); 00013 if (eq->RBevent) Rollback(); 00014 if (!parent->cancels.IsEmpty()) CancelEvents(); 00015 parent->Status(); 00016 00017 if (rbFlag) { 00018 timeLeash = eq->currentPtr->timestamp - lastGVT; 00019 if (timeLeash < pose_config.min_leash) timeLeash = pose_config.min_leash; 00020 } 00021 else if (timeLeash < pose_config.max_leash) timeLeash += pose_config.leash_flex; 00022 // Shorten the leash as we near POSE_endtime 00023 if ((POSE_endtime > POSE_UnsetTS) && (lastGVT + timeLeash > POSE_endtime)) 00024 timeLeash = POSE_endtime - lastGVT; 00025 // Prepare to execute an event 00026 ev = eq->currentPtr; 00027 while ((ev->timestamp > POSE_UnsetTS) && 00028 (ev->timestamp <= lastGVT + timeLeash)) { 00029 // do all events at under timeLeash 00030 iter++; 00031 currentEvent = ev; 00032 ev->done = 2; 00033 parent->ResolveFn(ev->fnIdx, ev->msg); // execute it 00034 ev->done = 1; // complete the event execution 00035 eq->mem_usage++; 00036 eq->ShiftEvent(); // shift to next event 00037 ev = eq->currentPtr; 00038 } 00039 #if !CMK_TRACE_DISABLED 00040 if(pose_config.stats) 00041 if (iter > 0) localStats->Loop(); 00042 #endif 00043 } 00044