Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionBoth sides next revision | ||
alvis:proc [2013/12/29 20:30] marcin created | — (current) | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Proc statement ====== | ||
- | **Passive agents** are used to store data shared among agents and to avoid the simultaneous use of such data by two or more agents. They provide a set of **procedures** that can be called by other agents. Each procedure has its own port attached and a communication with a passive agent via that port is treated as the corresponding procedure call. Depending on the communication direction, such a procedure may be used to send or collect some data from the passive agent. | ||
- | |||
- | |||
- | |||
- | < | ||
- | proc (g) p {...} | ||
- | </ | ||
- | |||
- | **Listing 1. ** Proc statement syntax, where '' | ||
- | |||
- | A procedure is accessible for other agents only if the guard evaluates to '' | ||
- | |||
- | |||
- | |||
- | |||
- | ===== Example ===== | ||
- | |||
- | This is a part of a model only! | ||
- | |||
- | {{: | ||
- | |||
- | < | ||
- | agent Buffer { | ||
- | i :: Int = 0; | ||
- | proc pop { out pop i; } | ||
- | proc push { in push i; } | ||
- | } | ||
- | </ | ||
- | |||
- | |||
- | **[[: |