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 } |
65} 66 67 68const char * 69SimLoopExitEvent::description() 70{ 71 return "simulation loop exit"; 72} 73 |
74SimLoopExitEvent * 75schedExitSimLoop(const std::string &message, Tick when, Tick repeat, 76 EventQueue *q, int exit_code) |
77{ |
78 if (q == NULL) 79 q = &mainEventQueue; 80 81 return new SimLoopExitEvent(q, when, repeat, message, exit_code); |
82} 83 84void 85exitSimLoop(const std::string &message, int exit_code) 86{ |
87 schedExitSimLoop(message, curTick, 0, NULL, exit_code); |
88} 89 90void 91CountedDrainEvent::process() 92{ 93 if (--count == 0) { 94 exitSimLoop("Finished drain"); 95 } --- 83 unchanged lines hidden --- |