Replace startUp with startUp: (was: Re: [squeak-dev] The Trunk: Kernel-mt.987.mcz)

Chris Muller asqueaker at gmail.com
Fri Feb 5 00:55:26 UTC 2016


Every time I want to do something in start up or shutdown, I find I
keep having to find examples and study these two methods; which calls
which?  What's the default arg?  And does the "resuming" boolean mean
the user pressed "Save" on the World Menu and resuming use of the
image, or does it mean just launched from the OS..?

Anything that would make these more lucid would be welcome.

On Thu, Feb 4, 2016 at 5:41 PM, Eliot Miranda <eliot.miranda at gmail.com> wrote:
>
>
>> On Feb 4, 2016, at 10:02 AM, Levente Uzonyi <leves at caesar.elte.hu> wrote:
>>
>> While we are at it, it would be great to finally get rid of all implementations of #startUp, and use #startUp: instead.
>>
>> Why?
>> - implementing #startUp: in a class can interfere with the implementations of #startUp in its subclasses (yes, it actually has happened)
>> - #startUp runs on image save, and in most cases, like this one, it shouldn't
>>
>> I think the same applies to #shutDown and #shutDown:.
>
> +1.  Use of startUp: allows the method to do things only in system startup rather than in return from snapshot and is consequently more economical.
>
>
>>
>> Levente
>>
>>> On Thu, 4 Feb 2016, commits at source.squeak.org wrote:
>>>
>>> Marcel Taeumel uploaded a new version of Kernel to project The Trunk:
>>> http://source.squeak.org/trunk/Kernel-mt.987.mcz
>>>
>>> ==================== Summary ====================
>>>
>>> Name: Kernel-mt.987
>>> Author: mt
>>> Time: 4 February 2016, 3:06:38.350057 pm
>>> UUID: acfc6690-1289-41c3-984b-7f781b4a0a3f
>>> Ancestors: Kernel-eem.986
>>>
>>> Fixes regression with a non-working event handling mechanism on Windows machines, which occured due to the recent removal of InputSensor.
>>>
>>> Also fixes the double-interrupt problem when pressing CMD+.
>>>
>>> =============== Diff against Kernel-eem.986 ===============
>>>
>>> Item was changed:
>>> ----- Method: EventSensor class>>initialize (in category 'class initialization') -----
>>> initialize
>>>
>>>    Smalltalk addToStartUpList: self after: Cursor.
>>> +    Smalltalk addToShutDownList: self.
>>> +
>>>    self installKeyDecodeTable.
>>>    self installMouseDecodeTable.
>>>    self install.
>>>
>>> !
>>>
>>> Item was changed:
>>> ----- Method: EventSensor>>shutDown (in category 'initialize') -----
>>> shutDown
>>> +
>>>    InterruptWatcherProcess ifNotNil: [
>>>        InterruptWatcherProcess terminate.
>>> +        InterruptWatcherProcess := nil ].
>>> +
>>> +    EventTicklerProcess ifNotNil: [
>>> +        EventTicklerProcess terminate.
>>> +        EventTicklerProcess := nil. ].
>>> +
>>> +    inputSemaphore ifNotNil:[Smalltalk unregisterExternalObject: inputSemaphore].!
>>> -        InterruptWatcherProcess := nil ].!
>>>
>>> Item was changed:
>>> ----- Method: EventSensor>>startUp (in category 'initialize') -----
>>> startUp
>>> +
>>> +    self initialize.
>>> +    self primSetInputSemaphore: (Smalltalk registerExternalObject: inputSemaphore).
>>> +
>>> +    self installInterruptWatcher.
>>> +    self installEventTickler.
>>> +
>>> +    Smalltalk isMorphic ifTrue: [self flushAllButDandDEvents].
>>> +
>>> +    "Attempt to discover whether the input semaphore is actually being signaled."
>>> +    hasInputSemaphore := false.
>>> +    inputSemaphore initSignals.!
>>> -    self installInterruptWatcher.!
>>>
>>>
>>>
>>
>


More information about the Squeak-dev mailing list