sim_events.cc (9328:2fa2b16bdfc2) sim_events.cc (9342:6fec8f26e56d)
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;

--- 69 unchanged lines hidden (view full) ---

78
79void
80exitSimLoop(const std::string &message, int exit_code, Tick when, Tick repeat)
81{
82 Event *event = new SimLoopExitEvent(message, exit_code, repeat);
83 mainEventQueue.schedule(event, when);
84}
85
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;

--- 69 unchanged lines hidden (view full) ---

78
79void
80exitSimLoop(const std::string &message, int exit_code, Tick when, Tick repeat)
81{
82 Event *event = new SimLoopExitEvent(message, exit_code, repeat);
83 mainEventQueue.schedule(event, when);
84}
85
86CountedDrainEvent::CountedDrainEvent()
87 : count(0)
88{ }
89
90void
91CountedDrainEvent::process()
92{
93 if (--count == 0)
94 exitSimLoop("Finished drain", 0);
95}
96
97//
98// constructor: automatically schedules at specified time
99//
100CountedExitEvent::CountedExitEvent(const std::string &_cause, int &counter)
101 : Event(Sim_Exit_Pri), cause(_cause), downCounter(counter)
102{
103 // catch stupid mistakes
104 assert(downCounter > 0);

--- 20 unchanged lines hidden ---
86//
87// constructor: automatically schedules at specified time
88//
89CountedExitEvent::CountedExitEvent(const std::string &_cause, int &counter)
90 : Event(Sim_Exit_Pri), cause(_cause), downCounter(counter)
91{
92 // catch stupid mistakes
93 assert(downCounter > 0);

--- 20 unchanged lines hidden ---