>From 15c688fbb829e24cdd7f2129cc7e0b4adef36c41 Mon Sep 17 00:00:00 2001 From: Gwenael Casaccio 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 + + * Misc/TaskQueue.st: Catch Error and not Exception, the semaphore can only be signaled one time. + 2013-11-13 Gwenael Casaccio * 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