-- /ivy/binding/hickory/hickoryNotifyImpl.mesa -- implementing the client notification of hickory -- Last edited by: Binding, August 14, 1984 8:28:23 am PDT DIRECTORY Hickory USING [ Event, Reason, NotifyProc], HickoryNotify, Process USING [ Detach], RopeSets USING [ RopeSet] ; HickoryNotifyImpl: CEDAR MONITOR IMPORTS Process EXPORTS HickoryNotify, Hickory = BEGIN ProcQueueEl: TYPE = RECORD [ Proc: Hickory.NotifyProc, Next: ProcQueue _ NIL ]; ProcQueue: TYPE = REF ProcQueueEl; procQueue: ProcQueue _ NIL; RegisterNotifyProc: PUBLIC ENTRY PROCEDURE [ proc: Hickory.NotifyProc] = BEGIN new: ProcQueue _ NEW[ ProcQueueEl]; new.Proc _ proc; IF procQueue = NIL THEN procQueue _ new ELSE BEGIN new.Next _ procQueue; procQueue _ new; END; END; -- RegisterNotifyProc RemoveNotifyProc: PUBLIC ENTRY PROCEDURE [ proc: Hickory.NotifyProc] = BEGIN prev, cur: ProcQueue; IF procQueue = NIL THEN RETURN; prev _ NIL; cur _ procQueue; WHILE cur # NIL AND cur.Proc # proc DO prev _ cur; cur _ cur.Next; ENDLOOP; IF cur # NIL THEN -- we found the proc! IF prev = NIL THEN BEGIN procQueue _ cur; cur.Next _ NIL; END ELSE BEGIN prev.Next _ cur.Next; cur.Next _ NIL; END; END; -- RemoveNotifyProc NotifyClients: PUBLIC ENTRY PROCEDURE [ reason: Hickory.Reason, ev: Hickory.Event, data: RopeSets.RopeSet] = BEGIN cur: ProcQueue _ procQueue; WHILE cur # NIL DO TRUSTED { Process.Detach[ FORK cur.Proc[ reason, ev, data]]}; cur _ cur.Next; ENDLOOP; END; -- NotifyProc END. 2this is a separate monitor... not locked by the lock defined in HickoryStorage! Type declarations Global variables ( protected through monitor) Operations here we insert a new procedure into queue. NoOp if not previously registered to fork off a notification process for each registered notify proc. Ê“˜J˜.J˜2J˜:J˜šÏk ˜ Jšœœ˜+J˜Jšœœ ˜Jšœ œ ˜J˜J˜—šœœ˜ JšœO™OJšœ˜Jšœ˜J˜—šœ˜J˜—J˜šœ™J˜šœ œœ˜J˜Jšœ˜J˜J˜—Jšœ œœ ˜"J˜—šœ-™-J˜Jšœœ˜J˜—šœ ™ J˜š Ïnœœœ œ˜NJšœ*™*Jšœœ˜#J˜Jšœ œœ˜'šœ˜ J˜J˜Jšœ˜—JšœÏc˜J˜—š žœœœ œ˜LJšœ!™!J˜J˜Jšœ œœœ˜Jšœœ˜šœœœ˜&J˜Jšœ˜—šœœœŸ˜(šœœœ˜J˜Jšœ œ˜Jš˜—šœ˜ J˜Jšœ œ˜Jšœ˜——JšœŸ˜—š ž œœœ œH˜rJšœC™CJ˜J˜šœœ˜Jšœœ˜=J˜Jšœ˜—JšœŸ ˜J˜—Jšœ˜——…—À …