From febab25957066cf9b470864b6bda38687918b36d Mon Sep 17 00:00:00 2001 From: Michael LeBeane Date: Tue, 13 Sep 2016 23:08:34 -0400 Subject: dev: Exit correctly in dist-gem5 The receiver thread in dist_iface is allowed to directly exit the simulation. This can cause exit to be called twice if the main thread simultaneously wants to exit the simulation. Therefore, have the receiver thread enqueue a request to exit on the primary event queue for the main simulation thread to handle. --- src/dev/net/dist_iface.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/dev/net/dist_iface.cc') diff --git a/src/dev/net/dist_iface.cc b/src/dev/net/dist_iface.cc index 1025dffe3..0e48770ed 100644 --- a/src/dev/net/dist_iface.cc +++ b/src/dev/net/dist_iface.cc @@ -610,10 +610,10 @@ DistIface::recvThreadFunc(Event *recv_done, Tick link_delay) // because one of them called m5 exit. So we stop here. // Grab the eventq lock to stop the simulation thread curEventQueue()->lock(); - exit_message("info", - 0, - "Message server closed connection, " - "simulation is exiting"); + exitSimLoop("Message server closed connection, simulator " + "is exiting"); + curEventQueue()->unlock(); + break; } // We got a valid dist header packet, let's process it -- cgit v1.2.3