In article <86484@palm-dev-forum>, [EMAIL PROTECTED] says...
> 
> Hrms.. Rebuilding the runtime libs made this go away ;)
> 
> Now I'm totally confused.  I don't have 3000 calls to anything in the
> profile anymore... 

Did you rebuild the runtimes when you upgraded to 8.2?  That's part of 
the instructions... very interesting.

EventThunks were invented because of a problem that can occur with form 
event handlers.

A standard thunk stores the return value of A4 and the return address 
inside itself using self-modifying code.  Since thunks live in RAM, this 
is OK, and there's nowhere else to store this information in a argument 
neutral format.

This works fine, as long as there won't be two or more calls to the same 
thunk on the stack at a time.  With form event handlers, this situation 
can happen -- consider the case where you are processing an event and do 
something that causes a frmUpdateEvent to be posted back to your form 
immediately.

An EventThunk stores the old A4 value and the return address on the 
stack.  Its able to do this because it knows exactly how many bytes of 
arguments are used for a FrmEventHandler function, so it can repush 
those parameters, and modify the hole that's left, so the handler will 
return to it and let it fix things back up.

-- 
Ben Combee <[EMAIL PROTECTED]>
CodeWarrior for Palm OS technical lead
Get help at http://palmoswerks.com/

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to