From 29d60c55d1aaec54588814408aa2abe18f72d6aa Mon Sep 17 00:00:00 2001 From: Bernd Hufmann Date: Mon, 4 Nov 2013 14:26:22 -0500 Subject: [PATCH] tmf: Update the suspend and resume handling of requests The new implementation handles the event before suspending the thread requested by the request executor. In the previous implementation the thread is suspended before handleData() which causes unnecessary handling of data if the request is canceled during the time the thread is suspended. Change-Id: I25e143db734ebf524630651e4ac779a7b4657e6a Signed-off-by: Bernd Hufmann Reviewed-on: https://git.eclipse.org/r/18045 Reviewed-by: Patrick Tasse IP-Clean: Patrick Tasse Tested-by: Hudson CI Reviewed-by: Bernd Hufmann IP-Clean: Bernd Hufmann Tested-by: Bernd Hufmann --- .../internal/tmf/core/component/TmfEventThread.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/component/TmfEventThread.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/component/TmfEventThread.java index 62b2d455ce..05475ba491 100644 --- a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/component/TmfEventThread.java +++ b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/component/TmfEventThread.java @@ -176,13 +176,15 @@ public class TmfEventThread implements Runnable { TmfCoreTracer.traceRequest(fRequest, "read first event"); //$NON-NLS-1$ while (event != null && !fProvider.isCompleted(fRequest, event, nbRead)) { - pausedLatch.await(); TmfCoreTracer.traceEvent(fProvider, fRequest, event); if (fRequest.getDataType().isInstance(event)) { fRequest.handleData(event); } + // Pause execution if requested + pausedLatch.await(); + // To avoid an unnecessary read passed the last event requested if (++nbRead < nbRequested) { event = fProvider.getNext(context); -- 2.34.1