On 05/12/2013 14:37, Gwenaël Casaccio wrote:
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
Thanks Holger to your remark, the current implementation is better
Gwen
>From ee7b5bb3ffdc92eefec4633c425a95c1d8d2b897 Mon Sep 17 00:00:00 2001
From: Gwenael Casaccio <[email protected]>
Date: Thu, 5 Dec 2013 15:25:26 +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..9107f6b 100644
--- a/packages/visualgst/Misc/TaskQueue.st
+++ b/packages/visualgst/Misc/TaskQueue.st
@@ -71,9 +71,13 @@ Object subclass: TaskQueue [
queueHandler := [ | task sem |
sem := Semaphore new.
[ task := queue next.
- currentProcess := [ [ task value.
- sem signal ] on: Exception do: [ :ex | [ sem signal ] fork.
- ex pass ] ] fork.
+ currentProcess := [ | handled |
+ handled := false.
+ [ task value.
+ handled ifFalse: [ handled := true.
+ sem signal ] ] on: Error do: [ :ex | handled ifFalse: [ handled := true.
+ [ sem signal ] fork ].
+ 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