Specifying parameters when spawning
When spawning a monitor instance, you can pass parameters to an action. For example:
monitor m {
action onload() {
spawn forward("a", "channelA");
spawn forward("b", "channelB");
}
action forward(string arg, string channel) {
Event e;
on all Event(arg):e {
emit e to channel;
}
on StopForwarding(arg) {
die();
}
}
}
The following are equivalent:
spawn actionName(); // This is the correct syntax.
spawn actionName; // This is deprecated. Do not use it.
Copyright © 2013
Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or Terracotta Inc., San Francisco, CA, USA, and/or Software AG (Canada) Inc., Cambridge, Ontario, Canada, and/or, Software AG (UK) Ltd., Derby, United Kingdom, and/or Software A.G. (Israel) Ltd., Or-Yehuda, Israel and/or their licensors.