>I've spent a lot of time recently trying to figure out the following:
The examples given in the Icon and Unicon books for using coexpressions to implement a solution to a producer-consumer problem all depend on the consumer coexp being activated before the producer coexp in order to receive the first value transmitted by the producer coexp.
I thought that I would share my successful attempt to have a consumer receive the first value transmitted by the producer regardless of whether it was activated first. Basically, there is one producer and two consumers; the consumer is chosen "randomly"
Nice!
> ...(although I find that I get the same output
for every run, so something is amiss in my random selection).
Nothing's amiss, you just are using the default random seed, which is constant between runs. That aids debugging, but as you noted, can be confusing. Take a look at the initRandom() procedure in the "unilib" files [use is:
Utils::initRandom()
] which sets the initial random seed to a random value. It's defined in MiscUtils.icn. (It's not fancy, and simply saves a little typing if you have access to the Utils package.)
-- Steve Wampler -- [EMAIL PROTECTED] The gods that smiled on your birth are now laughing out loud.
------------------------------------------------------- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl _______________________________________________ Unicon-group mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/unicon-group
