class: AbstractBackgroundJob
authorClaus Gittinger <cg@exept.de>
Sat, 08 Aug 2015 11:30:22 +0200
changeset 3592 ff7df9bc1032
parent 3591 71ce2d98b99d
child 3593 3476aa995618
class: AbstractBackgroundJob class definition added: #isDebuggerJob #isDebuggerJob: changed: #startWithPriority:
AbstractBackgroundJob.st
--- a/AbstractBackgroundJob.st	Thu Jul 23 21:03:28 2015 +0200
+++ b/AbstractBackgroundJob.st	Sat Aug 08 11:30:22 2015 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague
 	      All Rights Reserved
@@ -28,7 +30,7 @@
 "{ NameSpace: Smalltalk }"
 
 Object subclass:#AbstractBackgroundJob
-	instanceVariableNames:'name job priority thread running'
+	instanceVariableNames:'name job priority thread running isDebuggerJob'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'System-Support'
@@ -142,6 +144,19 @@
 
 !AbstractBackgroundJob methodsFor:'accessing'!
 
+isDebuggerJob
+    ^ isDebuggerJob ? false
+!
+
+isDebuggerJob:aBoolean
+    "added to allow suppression of breakpoints/halts of a
+     job started by the debugger 
+     (if you ask what this is for,
+      try to put a breakpoint into the syntaxhighlighter in the old schema)"
+     
+    isDebuggerJob := aBoolean
+!
+
 job
     ^ job
 !
@@ -294,15 +309,24 @@
     | t |
 
     ((t := thread) isNil or:[t isDead]) ifTrue:[
-        thread := [
+        thread := 
             [
-                running := true.
-                self process
-            ] ensure: [
-                running := false.
-                thread := nil
-            ]
-        ] newProcess.
+                [
+                    ControlInterrupt handle:[:ex |
+                        self isDebuggerJob ifTrue:[
+                            Transcript showCR:'halt/breakpoint ignored in debugger job'.
+                            ex proceed.
+                        ].
+                        ex reject
+                    ] do:[    
+                        running := true.
+                        self process
+                    ].    
+                ] ensure: [
+                    running := false.
+                    thread := nil
+                ].    
+            ] newProcess.
         self setupThread: thread priority: prio.
         thread resume.
     ]
@@ -328,10 +352,10 @@
 !AbstractBackgroundJob class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic2/AbstractBackgroundJob.st,v 1.2 2015-02-21 22:43:08 vrany Exp $'
+    ^ '$Header$'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic2/AbstractBackgroundJob.st,v 1.2 2015-02-21 22:43:08 vrany Exp $'
+    ^ '$Header$'
 ! !