[comp.windows.news] YinYang bug...

gregm@SUN.COM (Greg McLaughlin) (08/16/88)

There is a small bug in the YinYang root spin routine sent out a
while back. Once awaitevent returns it needed to pop the
unused event. If run long enough the NeWS stack would overflow.

Here is the patched version:

Greg McLaughlin
Sun Microsystems Inc.

----------------------------TimeYinYang----------------------------------
% Set the yin/yang to spin by queuing events.
/TimeYinYang { % - => process
  {
    /d 2 dict dup begin
      /RotateYinYang {
        /YinYangAng YinYangAng 5 add store % change the 5 to adjust
                                           % the speed
        gsave
        framebuffer setcanvas
        YinYangAng 160 60 yinyang
        grestore
        SendNewYinYangEvent
      } def
    end def
    /e1 createevent def
    e1 /Name d put
    e1 expressinterest
    /SendNewYinYangEvent {
        e1 createevent copy dup begin
        /Name /RotateYinYang def
        /TimeStamp currenttime .05 add def
      end
      sendevent
    } def
    SendNewYinYangEvent
    { awaitevent pop} loop
  } fork
} def