This is the mail archive of the
frysk@sources.redhat.com
mailing list for the frysk project.
event-loop thread changing
- From: Andrew Cagney <cagney at redhat dot com>
- To: frysk <frysk at sourceware dot org>
- Date: Tue, 17 Apr 2007 13:19:55 -0400
- Subject: event-loop thread changing
Hi,
Linux's ptrace that all ptrace operations originate from the same thread
- tid1.attatch, tid2.peek is not allowed. Frysk currently works round
this limitation by having a dedicated ptrace server thread.
I'm now trying to eliminate that server thread and its overhead by,
instead, having the event-loop thread handle ptrace calls locally. In
trying to implement the change I've found that a number of test-cases
are switching the thread running the event-loop mid-stream. Typically
this happens with something like:
eventLoop.requestSchedule();
eventLoop.run();
...;
eventLoop.start();
I've added checks to EventLoop to detect this - right now they complain
but not too loudly - going forward it will trigger a panic. Even
without the ptrace issue, changing threads is bad.
The best approach here is to run the event-loop from the main test
thread, and then run additional parallel operations from separate
short-term threads. See TestBreakpoints for an example. If nothing
else, it ensures that any event-loop panic occures within the test
thread allowing junit to correctly clean up.
Andrew