(FILECREATED "28-Jan-86 01:16:53" {ERIS}<LISPUSERS>KOTO>PREEMPTIVE.;3 2518   

      changes to:  (FNS \PREEMPTIVE.BLOCK)

      previous date: " 9-Jan-86 14:10:00" {ERIS}<LISPUSERS>KOTO>PREEMPTIVE.;2)


(* Copyright (c) 1984, 1985, 1986 by Xerox Corporation. All rights reserved.)

(PRETTYCOMPRINT PREEMPTIVECOMS)

(RPAQQ PREEMPTIVECOMS [(FNS \PREEMPTIVE.BLOCK PROCESS-STATUS)
                       (DECLARE: DONTEVAL@LOAD DOCOPY (VARS (\PERIODIC.INTERRUPT (QUOTE 
                                                                                    \PREEMPTIVE.BLOCK
                                                                                        ))
                                                            (\PERIODIC.INTERRUPT.FREQUENCY 20])
(DEFINEQ

(\PREEMPTIVE.BLOCK
  [LAMBDA NIL                                                              (* lmm 
                                                                           "28-Jan-86 01:16")
    (COND
       ((AND \INTERRUPTABLE (OR (NOT (fetch PROCSYSTEMP of (THIS.PROCESS)))
                                (EQ (THIS.PROCESS)
                                    (TTY.PROCESS)))
             (EQ (PROCESS-STATUS 1)
                 (QUOTE RUNNING)))
        (BLOCK])

(PROCESS-STATUS
  [LAMBDA (POS)                                              (* lmm " 9-Jan-86 13:29")
    (LET ((POS (if POS
		   then (if (LITATOM POS)
			      then (FIND.PROCESS POS)
			    else POS)
		 else 2)))
         (AND POS (LET ((STKI (\STACKARGPTR POS)))
		         (do (SELECTQ (fetch (FX FRAMENAME) of STKI)
					  ((\INTERRUPTFRAME \INTERRUPTED INTERRUPTED 
							      \DOINTERRUPTHERE 
							      \PERIODIC.INTERRUPTFRAME ERRORSET)
                                                             (* Skip over these)
					    (SETQ STKI (fetch (FX CLINK) of STKI)))
					  ((\GETCHAR \GETKEY \TTYBACKGROUND GETMOUSESTATE 
						       MENU.HANDLER)
					    (RETURN (QUOTE IO.WAIT)))
					  ((BLOCK \BACKGROUND AWAIT.EVENT MONITOR.AWAIT.EVENT 
						    \PROCESS.GO.TO.SLEEP)
                                                             (* Forms of blocking)
					    (RETURN (QUOTE WAITING)))
					  (RETURN (QUOTE RUNNING])
)
(DECLARE: DONTEVAL@LOAD DOCOPY 

(RPAQQ \PERIODIC.INTERRUPT \PREEMPTIVE.BLOCK)

(RPAQQ \PERIODIC.INTERRUPT.FREQUENCY 20)
)
(PUTPROPS PREEMPTIVE COPYRIGHT ("Xerox Corporation" 1984 1985 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (756 2304 (\PREEMPTIVE.BLOCK 766 . 1238) (PROCESS-STATUS 1240 . 2302)))))
STOP