COGSTOP
Command: Stop cog by its ID.
((PUB ┆ PRI))
COGSTOP (CogID )
- CogID is the ID (0 – 7) of the cog to stop.
Explanation
COGSTOP stops a cog whose ID is CogID and places that cog into a dormant state. In the dormant state, the cog ceases to receive System Clock pulses so that power consumption is greatly reduced.
To stop a cog, issue the COGSTOP command with the ID of the cog to stop. For example:
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)
This example, from the COGNEW description, uses COGSTOP in the public Stop method to stop the cog that was previously started by the Start method. See COGNEW for more information about this example.
Unless otherwise noted, content on this site is licensed under the
Creative Commons Attribution-ShareAlike 4.0 International License.