From 221f4f232ae79b8123e7ce28d26a873e1ba9f9dc Mon Sep 17 00:00:00 2001 From: Andreas Sandberg Date: Wed, 9 Apr 2014 16:01:43 +0200 Subject: 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. --- src/dev/ethertap.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/dev/ethertap.cc') diff --git a/src/dev/ethertap.cc b/src/dev/ethertap.cc index 94e381a8e..e14fd90c2 100644 --- a/src/dev/ethertap.cc +++ b/src/dev/ethertap.cc @@ -106,6 +106,11 @@ TapListener::listen() void TapListener::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(tap->eventQueue()); + if (!listener.islistening()) panic("TapListener(accept): cannot accept if we're not listening!"); -- cgit v1.2.3