>From ee7b5bb3ffdc92eefec4633c425a95c1d8d2b897 Mon Sep 17 00:00:00 2001 From: Gwenael Casaccio 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 + + * 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..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