The Inbox: System-ct.1514.mcz
| Newsgroups | gmane.comp.lang.smalltalk.squeak.general |
|---|---|
| Message-ID | <[email protected]> |
Christoph Thiede uploaded a new version of System to project The Inbox: http://source.squeak.org/inbox/System-ct.1514.mcz ==================== Summary ==================== Name: System-ct.1514 Author: ct Time: 29 May 2026, 7:29:12.838713 pm UUID: d6c58fa7-b8ca-4d8a-8988-4d8ce9ca92df Ancestors: System-mt.1513 For discussion: Avoid busy waiting/battery drain in emergency evaluator by introducing an inter-cycle pause. Unless you would consider the revving CPU fan an auditory feedback for a recursive error. :-) Or should we customize this with a preference? In the VMMaker simulator, 10 milliSeconds can be a long time ... but we should keep this code as simple as possible ... Or would it be outright wrong to involve any scheduling code in the emergency evaluator? =============== Diff against System-mt.1513 =============== Item was changed: ----- Method: Project class>>tryEmergencyEvaluatorForRecovery: (in category 'error recovery') ----- tryEmergencyEvaluatorForRecovery: errorMessage | hasTranscripter transcripter | "Make sure to display something." Display deferUpdates: false. hasTranscripter := (Smalltalk classNamed: #Transcripter) ifNotNil: [ :t | transcripter := t. true] ifNil: [false]. (String streamContents: [:s | | context | s nextPutAll: '***System error handling failed***'. s cr; nextPutAll: errorMessage. context := thisContext sender sender. 20 timesRepeat: [context == nil ifFalse: [s cr; print: (context := context sender)]]. s cr; nextPutAll: '-------------------------------'. hasTranscripter ifTrue: [ s cr; nextPutAll: 'Type CR to enter an emergency evaluator.'. s cr; nextPutAll: 'Type any other character to restart.'] ifFalse: [ s cr; nextPutAll: 'Type any character to restart.']]) displayAt: 0 @ 0. + [Sensor keyboardPressed] whileFalse: [10 milliSeconds wait]. - [Sensor keyboardPressed] whileFalse. Sensor keyboard = Character cr ifTrue: [ hasTranscripter ifTrue: [transcripter emergencyEvaluator]].! Item was changed: ----- Method: Transcripter>>request: (in category 'command line') ----- request: prompt | startPos char contents | self cr; show: prompt. startPos := position. + [[Sensor keyboardPressed] whileFalse: [10 milliSeconds wait]. - [[Sensor keyboardPressed] whileFalse. (char := Sensor keyboard) = Character cr] whileFalse: [char = Character backspace ifTrue: [readLimit := position := (position - 1 max: startPos)] ifFalse: [self nextPut: char]. self endEntry]. contents := self contents. ^ contents copyFrom: startPos + 1 to: contents size! Squeak-dev mailing list -- [email protected] To unsubscribe send an email to [email protected]