-
-
Save jasondown/6a1a190ea5621a67f6b956a58a416c0d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Run simulation | |
let cts = new System.Threading.CancellationTokenSource() | |
Async.Start(startOrdering cust1 3, cts.Token) // order every 3 seconds | |
Async.Start(startOrdering cust2 5, cts.Token) // order every 5 seconds | |
Async.Start(startOrdering cust3 1, cts.Token) // order every second nom nom | |
// Call either of these at random times to see there is no blocking | |
// during the simulation or to see how the restocking message causes | |
// different behaviour depending on the current state of the vending | |
// machine and its queued messages | |
vm.Restock(10) | |
showCurrentStock() | |
// If needed, stop the entire simulation | |
cts.Cancel() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment