On 02/12/2013 20:13, Holger Hans Peter Freyther wrote:
Good Evening,

I played somemore with the debugger and noticed an unwanted interaction
with the TaskQueue:

    [:each | each halt. 'abc' printNl ] value: 3

So "each halt" will show up the debugger. My assumption was that when
I press "F8" I would end up at "'abc' printNl" but I end in the TaskQueue
exception handler and then my process is aborted.

Do you think there is a way to have TaskQueue work and still be able to
return to the right place inside this block?

holger

_______________________________________________
help-smalltalk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-smalltalk

Hi,

The patch only signal one time the semaphore and only
error are catched by the exception handler.

Cheers,
Gwen

>From 15c688fbb829e24cdd7f2129cc7e0b4adef36c41 Mon Sep 17 00:00:00 2001
From: Gwenael Casaccio <[email protected]>
Date: Thu, 5 Dec 2013 14:35:51 +0100
Subject: [PATCH] Only signal one time the sempahore, and catch Error instead
 of Exception

---
 packages/visualgst/ChangeLog         |  4 ++++
 packages/visualgst/Misc/TaskQueue.st | 10 +++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/packages/visualgst/ChangeLog b/packages/visualgst/ChangeLog
index d0d8499..fdfa39a 100644
--- a/packages/visualgst/ChangeLog
+++ b/packages/visualgst/ChangeLog
@@ -1,3 +1,7 @@
+2013-12-05  Gwenael Casaccio  <[email protected]>
+
+	* Misc/TaskQueue.st: Catch Error and not Exception, the semaphore can only be signaled one time. 
+
 2013-11-13  Gwenael Casaccio  <[email protected]>
 
 	* GtkLauncher.st: Initialize KeySnooper.
diff --git a/packages/visualgst/Misc/TaskQueue.st b/packages/visualgst/Misc/TaskQueue.st
index 150008d..5e2e471 100644
--- a/packages/visualgst/Misc/TaskQueue.st
+++ b/packages/visualgst/Misc/TaskQueue.st
@@ -70,10 +70,14 @@ Object subclass: TaskQueue [
 
         queueHandler := [ | task sem |
           sem := Semaphore new.
-          [ task := queue next.
+          [ | handled |
+            handled := false.
+            task := queue next.
             currentProcess := [ [ task value.
-                                  sem signal ] on: Exception do: [ :ex | [ sem signal ] fork.
-                                                                         ex pass ] ] fork.
+                                  handled ifFalse: [ sem signal ].
+                                  handled := true ] on: Error do: [ :ex | handled ifFalse: [ [ sem signal ] fork ].
+                                                                          handled := true.
+                                                                          ex pass ] ] fork.
             sem wait.
             currentProcess := nil ] repeat ] fork
     ]
-- 
1.8.3.2

_______________________________________________
help-smalltalk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-smalltalk

Reply via email to