Event mechanism in tweak

View: New views
5 Messages — Rating Filter:   Alert me  

Event mechanism in tweak

by Manuel Wellmann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

i have a general question concerning the event mechanism in tweak. When
signaling an event like:

MyClass>>doSomething
   ...
   self signal: #myEventHappened.
   ...

an handling it in:

MyClass>>onMyEventHappened
   <on: myEventHappened>
   self halt doSomeThingElse.

the event handler will be executed (and the debugger halts) when sending
"doSomething" within a tweak-workspace. Within a "normal" (squeak)
workspace this does not happen.
Where is this different behavior located exactly? When i debug both
scenarios i can not see the difference.

Best regards,

Manuel Wellmann
_______________________________________________
Tweak mailing list
Tweak@...
http://impara.de/mailman/listinfo/tweak

Re: Event mechanism in tweak

by Fournier Eric :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Manuel;

When Tweak is started, a completely separate event scheduler is  
started that is not running when in Morphic. Generally speaking, you  
can (and should) use the Morphic development tools to design Tweak  
code, but should run all Tweak code from within the Tweak  
environment. Hope this helps.

Eric Fournier
University Technology Development Center
University of Minnesota Office of Information Technology
emf@...



On May 22, 2006, at 4:16 PM, Manuel Wellmann wrote:

> Hello,
>
> i have a general question concerning the event mechanism in tweak.  
> When signaling an event like:
>
> MyClass>>doSomething
>   ...
>   self signal: #myEventHappened.
>   ...
>
> an handling it in:
>
> MyClass>>onMyEventHappened
>   <on: myEventHappened>
>   self halt doSomeThingElse.
>
> the event handler will be executed (and the debugger halts) when  
> sending "doSomething" within a tweak-workspace. Within a  
> "normal" (squeak) workspace this does not happen.
> Where is this different behavior located exactly? When i debug both  
> scenarios i can not see the difference.
>
> Best regards,
>
> Manuel Wellmann
> _______________________________________________
> Tweak mailing list
> Tweak@...
> http://impara.de/mailman/listinfo/tweak

_______________________________________________
Tweak mailing list
Tweak@...
http://impara.de/mailman/listinfo/tweak

Re: Event mechanism in tweak

by Bert Freudenberg-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Eric's explanation is correct.

We need a special scheduler because events are handled  
asynchronously. That is, the #signal: send returns immediately, it  
only schedules the handler script for execution. Only if the  
signalling script ends (or waits voluntarily), another script will be  
executed. In this way, Tweak can *guarantee* to not preempt any  
script by another one, removing a lot of the headaches normally  
associated with multiprocessing.

- Bert -

Am 22.05.2006 um 23:51 schrieb Fournier Eric:

> Manuel;
>
> When Tweak is started, a completely separate event scheduler is  
> started that is not running when in Morphic. Generally speaking,  
> you can (and should) use the Morphic development tools to design  
> Tweak code, but should run all Tweak code from within the Tweak  
> environment. Hope this helps.
>
> Eric Fournier
> University Technology Development Center
> University of Minnesota Office of Information Technology
> emf@...
>
>
>
> On May 22, 2006, at 4:16 PM, Manuel Wellmann wrote:
>
>> Hello,
>>
>> i have a general question concerning the event mechanism in tweak.  
>> When signaling an event like:
>>
>> MyClass>>doSomething
>>   ...
>>   self signal: #myEventHappened.
>>   ...
>>
>> an handling it in:
>>
>> MyClass>>onMyEventHappened
>>   <on: myEventHappened>
>>   self halt doSomeThingElse.
>>
>> the event handler will be executed (and the debugger halts) when  
>> sending "doSomething" within a tweak-workspace. Within a  
>> "normal" (squeak) workspace this does not happen.
>> Where is this different behavior located exactly? When i debug  
>> both scenarios i can not see the difference.
>>
>> Best regards,
>>
>> Manuel Wellmann

_______________________________________________
Tweak mailing list
Tweak@...
http://impara.de/mailman/listinfo/tweak

Re: Event mechanism in tweak

by Manuel Wellmann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Many thanks to both of you.

Could you point at the responsible class(es) for doing the scheduling in the
tweak environment? And: where (in the code) the event is delegated to that
scheduler?

Manuel

> Eric's explanation is correct.
>
> We need a special scheduler because events are handled
> asynchronously. That is, the #signal: send returns immediately, it
> only schedules the handler script for execution. Only if the
> signalling script ends (or waits voluntarily), another script will be
> executed. In this way, Tweak can *guarantee* to not preempt any
> script by another one, removing a lot of the headaches normally
> associated with multiprocessing.
>
> - Bert -
>
> Am 22.05.2006 um 23:51 schrieb Fournier Eric:
>
> > Manuel;
> >
> > When Tweak is started, a completely separate event scheduler is
> > started that is not running when in Morphic. Generally speaking,
> > you can (and should) use the Morphic development tools to design
> > Tweak code, but should run all Tweak code from within the Tweak
> > environment. Hope this helps.
> >
> > Eric Fournier
> > University Technology Development Center
> > University of Minnesota Office of Information Technology
> > emf@...
> >
> >
> >
> > On May 22, 2006, at 4:16 PM, Manuel Wellmann wrote:
> >
> >> Hello,
> >>
> >> i have a general question concerning the event mechanism in tweak.
> >> When signaling an event like:
> >>
> >> MyClass>>doSomething
> >>   ...
> >>   self signal: #myEventHappened.
> >>   ...
> >>
> >> an handling it in:
> >>
> >> MyClass>>onMyEventHappened
> >>   <on: myEventHappened>
> >>   self halt doSomeThingElse.
> >>
> >> the event handler will be executed (and the debugger halts) when
> >> sending "doSomething" within a tweak-workspace. Within a
> >> "normal" (squeak) workspace this does not happen.
> >> Where is this different behavior located exactly? When i debug
> >> both scenarios i can not see the difference.
> >>
> >> Best regards,
> >>
> >> Manuel Wellmann
>
> _______________________________________________
> Tweak mailing list
> Tweak@...
> http://impara.de/mailman/listinfo/tweak
>




_______________________________________________
Tweak mailing list
Tweak@...
http://impara.de/mailman/listinfo/tweak

Re: Event mechanism in tweak

by Bert Freudenberg-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

It's all in the 'Scripting' package - in particular ScriptScheduler,  
ScriptProcess, ScriptEvent etc.

The nessage flow from signal to being scheduled is roughly this:

Object>>signal:
Object>>signalEvent:
Object>>privateSignalEvent:
AsyncScriptMessageSend>>valueWithEvent:
ScriptProcess>>newScript
ScriptProcess>>privateRunMsg
ScriptProcess>>startScriptProcess
ScriptScheduler>>scheduleScript:

You'll need a pretty good understanding of Squeak's process handling  
to understand what's going on in detail.

- Bert -

Am 23.05.2006 um 12:46 schrieb manu@...:

> Many thanks to both of you.
>
> Could you point at the responsible class(es) for doing the  
> scheduling in the
> tweak environment? And: where (in the code) the event is delegated  
> to that
> scheduler?
>
> Manuel
>
>> Eric's explanation is correct.
>>
>> We need a special scheduler because events are handled
>> asynchronously. That is, the #signal: send returns immediately, it
>> only schedules the handler script for execution. Only if the
>> signalling script ends (or waits voluntarily), another script will be
>> executed. In this way, Tweak can *guarantee* to not preempt any
>> script by another one, removing a lot of the headaches normally
>> associated with multiprocessing.
>>
>> - Bert -
>>
>> Am 22.05.2006 um 23:51 schrieb Fournier Eric:
>>
>>> Manuel;
>>>
>>> When Tweak is started, a completely separate event scheduler is
>>> started that is not running when in Morphic. Generally speaking,
>>> you can (and should) use the Morphic development tools to design
>>> Tweak code, but should run all Tweak code from within the Tweak
>>> environment. Hope this helps.
>>>
>>> Eric Fournier
>>> University Technology Development Center
>>> University of Minnesota Office of Information Technology
>>> emf@...
>>>
>>>
>>>
>>> On May 22, 2006, at 4:16 PM, Manuel Wellmann wrote:
>>>
>>>> Hello,
>>>>
>>>> i have a general question concerning the event mechanism in tweak.
>>>> When signaling an event like:
>>>>
>>>> MyClass>>doSomething
>>>>   ...
>>>>   self signal: #myEventHappened.
>>>>   ...
>>>>
>>>> an handling it in:
>>>>
>>>> MyClass>>onMyEventHappened
>>>>   <on: myEventHappened>
>>>>   self halt doSomeThingElse.
>>>>
>>>> the event handler will be executed (and the debugger halts) when
>>>> sending "doSomething" within a tweak-workspace. Within a
>>>> "normal" (squeak) workspace this does not happen.
>>>> Where is this different behavior located exactly? When i debug
>>>> both scenarios i can not see the difference.
>>>>
>>>> Best regards,
>>>>
>>>> Manuel Wellmann



_______________________________________________
Tweak mailing list
Tweak@...
http://impara.de/mailman/listinfo/tweak