summaryrefslogtreecommitdiff
path: root/src/base
diff options
context:
space:
mode:
authorAndreas Sandberg <andreas@sandberg.pp.se>2014-04-09 16:01:43 +0200
committerAndreas Sandberg <andreas@sandberg.pp.se>2014-04-09 16:01:43 +0200
commit221f4f232ae79b8123e7ce28d26a873e1ba9f9dc (patch)
tree0d1f889216a233ee9bf44209d77dd321cf7e0be9 /src/base
parentd805e42b81de580342a615ea99491401943a14d4 (diff)
downloadgem5-221f4f232ae79b8123e7ce28d26a873e1ba9f9dc.tar.xz
dev: Protect PollEvent processing when running in parallel mode
The calling thread is undefined when the PollQueue services events. This implies that PollEvents need to handle the case where they are processed from a different thread than the thread that created the event. This changeset adds temporary event queue migrations to the VNC server, the ethernet tap device, and the terminal to protect them from inter-thread calls.
Diffstat (limited to 'src/base')
-rw-r--r--src/base/vnc/vncserver.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/base/vnc/vncserver.cc b/src/base/vnc/vncserver.cc
index debf82014..9ca575915 100644
--- a/src/base/vnc/vncserver.cc
+++ b/src/base/vnc/vncserver.cc
@@ -174,6 +174,11 @@ VncServer::listen(int port)
void
VncServer::accept()
{
+ // As a consequence of being called from the PollQueue, we might
+ // have been called from a different thread. Migrate to "our"
+ // thread.
+ EventQueue::ScopedMigration migrate(eventQueue());
+
if (!listener.islistening())
panic("%s: cannot accept a connection if not listening!", name());