...
To stop a cog, issue the COGSTOP command with the ID of the cog to stop. For example:
Code Block |
---|
VAR
byte Cog 'Used to store ID of newly started cog
PUB Start(Pos) : Pass
'Start a new cog to run Update with Pos,
'return TRUE if successful
Pass := (Cog := cognew(@Update, Pos) + 1) > 0
PUB Stop
'Stop the cog we started earlier, if any.
if Cog
cogstop(Cog~ - 1) |
...