Re: The Inbox: System-ct.1514.mcz

Lauren Pullen <[email protected]>
Newsgroups gmane.comp.lang.smalltalk.squeak.general
Message-ID <[email protected]>
Hi Christoph, List,

On 5/29/26 17:29, [email protected] wrote:
> 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?
Can't we just skip polling the keyboard in the image and let the call to
	keyboardBuffer(SharedQueue) >> next
in
	Sensor >> keyboard
handle the delay?  I guess I don't understand why we're effectively doing
	[aSharedQueue peek] whileFalse.
	value _ aSharedQueue next.

It does look like fetching and flushing the event queue with 
peekKeyboard prevents emergency evaluator input from destroying the 
Workspace content I'm testing from, so I'd like to propose the attached 
sources instead.  Maybe there's even a method that does this?

Squeak-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Project class-tryEmergencyEvaluatorForRecovery.st (text/plain, 1.2 KB)
'From Squeak6.0 of 10 September 2025 [latest update: #22155] on 29 May 2026 at 4:48:03 pm'!

!Project class methodsFor: 'error recovery' stamp: 'lrnp 5/29/2026 16:47'!
tryEmergencyEvaluatorForRecovery: errorMessage

	| hasTranscripter transcripter cr |

	"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.

	cr := Sensor keyboard = Character cr.
	"Prevent input from being sent to whatever had keyboard focus if resuming works."
	Sensor peekKeyboard.
	cr ifTrue: [
		Sensor peekKeyboard.
		hasTranscripter ifTrue: [transcripter emergencyEvaluator]].! !
Transcripter-request.st (text/plain, 656 B)
'From Squeak6.0 of 10 September 2025 [latest update: #22155] on 29 May 2026 at 4:47:57 pm'!

!Transcripter methodsFor: 'command line' stamp: 'lrnp 5/29/2026 16:47'!
request: prompt
	| startPos char contents | 
	self cr; show: prompt.
	startPos := position.
	[(char := Sensor keyboard) = Character cr]
		whileFalse:
		[char = Character backspace
			ifTrue: [readLimit := position := (position - 1 max: startPos)]
			ifFalse: [self nextPut: char].
		self endEntry].
	"Prevent input from being sent to whatever had keyboard focus if resuming works."
	Sensor peekKeyboard.
	contents := self contents.
	^ contents copyFrom: startPos + 1 to: contents size! !
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.