sim_events.cc (2839:d5dd8a3cdea0) | sim_events.cc (3144:b6e9e1811d71) |
---|---|
1/* 2 * Copyright (c) 2002-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 43 unchanged lines hidden (view full) --- 52 // queue. 53 if (theQueue() != &mainEventQueue) { 54 exitSimLoop(cause, code); 55 delete this; 56 } 57 58 // otherwise do nothing... the IsExitEvent flag takes care of 59 // exiting the simulation loop and returning this object to Python | 1/* 2 * Copyright (c) 2002-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 43 unchanged lines hidden (view full) --- 52 // queue. 53 if (theQueue() != &mainEventQueue) { 54 exitSimLoop(cause, code); 55 delete this; 56 } 57 58 // otherwise do nothing... the IsExitEvent flag takes care of 59 // exiting the simulation loop and returning this object to Python |
60 61 // but if you are doing this on intervals, don't forget to make another 62 if (repeat) { 63 schedule(curTick + repeat); 64 } |
|
60} 61 62 63const char * 64SimLoopExitEvent::description() 65{ 66 return "simulation loop exit"; 67} 68 | 65} 66 67 68const char * 69SimLoopExitEvent::description() 70{ 71 return "simulation loop exit"; 72} 73 |
69void 70exitSimLoop(Tick when, const std::string &message, int exit_code) | 74SimLoopExitEvent * 75schedExitSimLoop(const std::string &message, Tick when, Tick repeat, 76 EventQueue *q, int exit_code) |
71{ | 77{ |
72 new SimLoopExitEvent(when, message, exit_code); | 78 if (q == NULL) 79 q = &mainEventQueue; 80 81 return new SimLoopExitEvent(q, when, repeat, message, exit_code); |
73} 74 75void 76exitSimLoop(const std::string &message, int exit_code) 77{ | 82} 83 84void 85exitSimLoop(const std::string &message, int exit_code) 86{ |
78 exitSimLoop(curTick, message, exit_code); | 87 schedExitSimLoop(message, curTick, 0, NULL, exit_code); |
79} 80 81void 82CountedDrainEvent::process() 83{ 84 if (--count == 0) { 85 exitSimLoop("Finished drain"); 86 } --- 83 unchanged lines hidden --- | 88} 89 90void 91CountedDrainEvent::process() 92{ 93 if (--count == 0) { 94 exitSimLoop("Finished drain"); 95 } --- 83 unchanged lines hidden --- |