From 32cc2ea8b9173863adeaa03f4d7ee1635acfdef7 Mon Sep 17 00:00:00 2001 From: Xiangyu Dong Date: Wed, 29 Jan 2014 22:35:04 -0600 Subject: [PATCH] cpu: fix bug when TrafficGen deschedules event Committed by: Nilay Vaish --- src/cpu/testers/traffic_gen/traffic_gen.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/cpu/testers/traffic_gen/traffic_gen.cc b/src/cpu/testers/traffic_gen/traffic_gen.cc index 0f006e67e..b7f1ecd4e 100644 --- a/src/cpu/testers/traffic_gen/traffic_gen.cc +++ b/src/cpu/testers/traffic_gen/traffic_gen.cc @@ -119,6 +119,11 @@ TrafficGen::initState() unsigned int TrafficGen::drain(DrainManager *dm) { + if (!updateEvent.scheduled()) { + // no event has been scheduled yet (e.g. switched from atomic mode) + return 0; + } + if (retryPkt == NULL) { // shut things down nextPacketTick = MaxTick; -- 2.30.2