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.
// 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
ret = ::send(sock, buf, length, MSG_NOSIGNAL);
if (ret < 0) {
if (errno == ECONNRESET || errno == EPIPE) {
- inform("send(): %s", strerror(errno));
- exit_message("info", 0, "Message server closed connection, "
- "simulation is exiting");
+ exitSimLoop("Message server closed connection, simulation "
+ "is exiting");
} else {
panic("send() failed: %s", strerror(errno));
}