Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 1556
News FAQ
Search Home


next up previous contents index
Next: Creating Clients Up: Events Previous: await Statement


Point-to-Point Communication

Sometimes in a Glish system two clients need to communicate as fast as possible. If the system's Glish script only forwards events from one client to the other without modifying the events' values then you instead use a direct connection between the two. Glish supports this style of communication using the link statement. When executed, a link statement directs a client to send a particular event it generates directly to another client (perhaps renaming it). For example,

    link t->transformed_data to
         d->new_data
causes the client associated with t to send its transformed_data events directly to d's client, that sees them as new_data events. (Other events generated by t's client still go to the Glish interpreter.) The destination of a link can use the ``*" event to mean ``use the same name":
    link t->transformed_data to d->*
sends the transformed_data events along without renaming them.

You can suspend point-to-point links with the unlink statement:

    unlink t->transformed_data to
           d->new_data
This suspends the link formed in the first example above. Now t's agent sends its transformed_data events to the Glish interpreter and executes the corresponding whenever bodies. Executing another link statement restores the point-to-point link.

Presently, executing a link statement twice causes two links to be established. Thus

    link a->foo to b->bar
    link a->foo to b->bar
causes a to send each foo event to b twice (i.e., b sees two bar events). It seems unlikely that this behavior is desirable, since there may be times when you want to establish a link and are not sure if it has already been established. So you should not rely on this behavior as it may well change in the future.


next up previous contents index
Next: Creating Clients Up: Events Previous: await Statement   Contents   Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc., Washington, D.C.

Return to AIPS++ Home Page
2006-10-15