Process.st
changeset 24 20cfbafcd0a3
parent 13 62303f84ff5f
child 25 e34a6267c79b
--- a/Process.st	Sat Dec 18 01:13:54 1993 +0100
+++ b/Process.st	Sat Dec 18 01:15:58 1993 +0100
@@ -11,7 +11,8 @@
 "
 
 Link subclass:#Process
-         instanceVariableNames:'id prio state startBlock name exitAction'
+         instanceVariableNames:'id prio state startBlock name 
+			        pushedInterruptActions exitAction'
          classVariableNames:''
          poolDictionaries:''
          category:'Kernel-Processes'
@@ -22,7 +23,7 @@
 COPYRIGHT (c) 1992 by Claus Gittinger
              All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/Process.st,v 1.6 1993-12-11 00:54:42 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Process.st,v 1.7 1993-12-18 00:14:56 claus Exp $
 '!
 
 !Process methodsFor:'accessing'!
@@ -170,6 +171,23 @@
     Processor terminate:self
 ! !
 
+!Process methodsFor:'special'!
+
+interruptWith:aBlock
+    "interrupt the receiver and make it evaluate aBlock.
+     If the receiver is currently suspended, the block will be remembered
+     to be evaluated once the receiver wakes up"
+
+    ObjectMemory blockInterrupts.
+    pushedInterruptActions isNil ifTrue:[
+	pushedInterruptActions := OrderedCollection with:aBlock.
+	Processor scheduleForInterrupt:self
+    ] ifFalse:[
+        pushedInterruptActions addLast:aBlock.
+    ].
+    ObjectMemory unblockInterrupts.
+! !
+    
 !Process methodsFor:'printing'!
 
 printString