The Inbox: Collections-mt.923.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: Collections-mt.923.mcz

commits-2
A new version of Collections was added to project The Inbox:
http://source.squeak.org/inbox/Collections-mt.923.mcz

==================== Summary ====================

Name: Collections-mt.923
Author: mt
Time: 26 January 2021, 1:56:55.975966 pm
UUID: 7d07d822-4bdf-486c-bf81-0af98356ee28
Ancestors: Collections-ul.922

Makes Transcript's #endEntry thread-safe. Supports #forceUpdate property across processes, too.

=============== Diff against Collections-ul.922 ===============

Item was changed:
  WriteStream subclass: #TranscriptStream
+ instanceVariableNames: 'lastChar lock shouldFlush'
- instanceVariableNames: 'lastChar lock'
  classVariableNames: 'CharacterLimit ForceUpdate RedirectToStdOut'
  poolDictionaries: ''
  category: 'Collections-Streams'!
 
  !TranscriptStream commentStamp: 'fbs 12/30/2013 09:53' prior: 0!
  This class is a much simpler implementation of Transcript protocol that supports multiple views and very simple conversion to morphic.  Because it inherits from Stream, it is automatically compatible with code that is designed to write to streams.!

Item was added:
+ ----- Method: TranscriptStream>>doFlushToUiDependents (in category 'stream extensions - flush') -----
+ doFlushToUiDependents
+
+ self changed: #appendEntryLater. "mt: Maybe we can change #appendEntry in pluggable text fields and remove #appendEntryLater."
+ self class forceUpdate ifTrue: [Project current restore].
+ self reset.!

Item was changed:
  ----- Method: TranscriptStream>>endEntry (in category 'stream extensions') -----
  endEntry
  "Display all the characters since the last endEntry, and reset the stream"
  self lock critical:
+ [self redirectToStdOut
- [(self == Transcript and: [self class redirectToStdOut])
  ifTrue:
+ [self flushToStdOut]
- [FileStream stdout nextPutAll: self contents; flush]
  ifFalse:
+ [self flushToUiDependents]]!
- [self changed: (self class forceUpdate
- ifTrue: [#appendEntry]
- ifFalse: [#appendEntryLater])].
- self reset]!

Item was changed:
+ ----- Method: TranscriptStream>>flush (in category 'stream extensions - flush') -----
- ----- Method: TranscriptStream>>flush (in category 'stream extensions') -----
  flush
  self endEntry
  !

Item was added:
+ ----- Method: TranscriptStream>>flushToStdOut (in category 'stream extensions - flush') -----
+ flushToStdOut
+
+ FileStream stdout
+ nextPutAll: self contents;
+ flush.
+ self reset.!

Item was added:
+ ----- Method: TranscriptStream>>flushToUiDependents (in category 'stream extensions - flush') -----
+ flushToUiDependents
+
+ Project current uiProcess == Processor activeProcess
+ ifTrue: [self doFlushToUiDependents]
+ ifFalse: [self triggerFlushToUiDependents].!

Item was added:
+ ----- Method: TranscriptStream>>redirectToStdOut (in category 'testing') -----
+ redirectToStdOut
+ "The global property only controls the global Transcript. Extra transcripts are not redirected."
+
+ ^ self == Transcript and: [self class redirectToStdOut]!

Item was removed:
- ----- Method: TranscriptStream>>target (in category 'stream extensions') -----
- target
- ^(self == Transcript and: [self class redirectToStdOut])
- ifTrue: [FileStream stdout]
- ifFalse: [self]!

Item was added:
+ ----- Method: TranscriptStream>>triggerFlushToUiDependents (in category 'stream extensions - flush') -----
+ triggerFlushToUiDependents
+
+ | signal |
+ self assert: [Processor activeProcess ~~ Project current uiProcess].
+
+ signal := Semaphore new.
+ shouldFlush := true.
+ Project current addDeferredUIMessage: [
+ shouldFlush == true ifTrue: [
+ shouldFlush := false.
+ self doFlushToUiDependents].
+ signal signal].
+
+ self class forceUpdate ifTrue: [signal wait].!