Process.st
changeset 348 5ac1b6b43600
parent 345 cf2301210c47
child 359 b8df66983eff
equal deleted inserted replaced
347:0d4c08ca9da3 348:5ac1b6b43600
    22 
    22 
    23 Process comment:'
    23 Process comment:'
    24 COPYRIGHT (c) 1992 by Claus Gittinger
    24 COPYRIGHT (c) 1992 by Claus Gittinger
    25 	     All Rights Reserved
    25 	     All Rights Reserved
    26 
    26 
    27 $Header: /cvs/stx/stx/libbasic/Process.st,v 1.27 1995-05-16 17:08:29 claus Exp $
    27 $Header: /cvs/stx/stx/libbasic/Process.st,v 1.28 1995-05-18 15:09:58 claus Exp $
    28 '!
    28 '!
    29 
    29 
    30 !Process class methodsFor:'documentation'!
    30 !Process class methodsFor:'documentation'!
    31 
    31 
    32 copyright
    32 copyright
    43 "
    43 "
    44 !
    44 !
    45 
    45 
    46 version
    46 version
    47 "
    47 "
    48 $Header: /cvs/stx/stx/libbasic/Process.st,v 1.27 1995-05-16 17:08:29 claus Exp $
    48 $Header: /cvs/stx/stx/libbasic/Process.st,v 1.28 1995-05-18 15:09:58 claus Exp $
    49 "
    49 "
    50 !
    50 !
    51 
    51 
    52 documentation
    52 documentation
    53 "
    53 "
   690      Processor activeProcess withLowerPriorityDo:[3000 factorial]
   690      Processor activeProcess withLowerPriorityDo:[3000 factorial]
   691     "
   691     "
   692 !
   692 !
   693 
   693 
   694 uninterruptablyDo:aBlock
   694 uninterruptablyDo:aBlock
   695     "execute aBlock with interrupts blocked. This does not prevent
   695     "execute aBlock with interrupts blocked. 
   696      preemption by higher priority processes."
   696      This does not prevent preemption by a higher priority processes
       
   697      if any becomes runnable due to the evaluation of aBlock
       
   698      (i.e. if a semaphore is signalled there)."
   697 
   699 
   698     |wasBlocked|
   700     |wasBlocked|
   699 
   701 
   700     "we must keep track of blocking-state if this is called nested"
   702     "we must keep track of blocking-state if this is called nested"
   701 
   703 
   705 	0 "stc hint"
   707 	0 "stc hint"
   706     ]
   708     ]
   707 !
   709 !
   708 
   710 
   709 waitUntilTerminated
   711 waitUntilTerminated
   710     "wait until the receiver is terminated"
   712     "wait until the receiver is terminated.
       
   713      This method allows another process to wait till the receiver finishes."
   711 
   714 
   712     |wasBlocked|
   715     |wasBlocked|
   713 
   716 
   714     wasBlocked := OperatingSystem blockInterrupts.
   717     wasBlocked := OperatingSystem blockInterrupts.
   715     exitSemaphore isNil ifTrue:[exitSemaphore := Semaphore new].
   718     exitSemaphore isNil ifTrue:[exitSemaphore := Semaphore new].
   716     exitSemaphore wait.
   719     exitSemaphore wait.
   717     wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
   720     wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
   718 !
   721 !
   719 
   722 
   720 waitUntilSuspended
   723 waitUntilSuspended
   721     "wait until the receiver is suspended"
   724     "wait until the receiver is suspended."
   722 
   725 
   723     |wasBlocked|
   726     |wasBlocked|
   724 
   727 
   725     wasBlocked := OperatingSystem blockInterrupts.
   728     wasBlocked := OperatingSystem blockInterrupts.
   726     suspendSemaphore isNil ifTrue:[suspendSemaphore := Semaphore new].
   729     suspendSemaphore isNil ifTrue:[suspendSemaphore := Semaphore new].