Shop OBEX P1 Docs P2 Docs Learn Events
Silly COG Question — Parallax Forums

Silly COG Question

jazzedjazzed Posts: 11,803
edited 2011-02-06 02:43 in Propeller 1
What happens if Spin tries to stop a COG that is already stopped?

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2011-02-05 11:45
    It's like saying "stopped[ cog ] := true"

    If it's already true, it doesn't become any more true.

    The specified cog becomes stopped. If it's already stopped, it becomes stopped (still).
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-02-05 11:54
    The only danger I can see from stopping a cog that's already been stopped (say, in an object's start method) is that the cog in question may have been started subsequent to its first cogstop by a cognew elsewhere in the app. So it's always better for an object to remember the state of the cogs it spawns and not stop them redundantly.

    -Phil
  • jazzedjazzed Posts: 11,803
    edited 2011-02-05 13:22
    I wasn't trying to stop an already stopped COG. I just wanted to know what the effect should be. Seems like the command should have no effect.
  • HollyMinkowskiHollyMinkowski Posts: 1,398
    edited 2011-02-05 14:25
    It's like a NOP in assembly language. It just wastes a bit of time.

    Or maybe instead of just being stopped the cog is really really most seriously stopped :-)
  • Mike GreenMike Green Posts: 23,101
    edited 2011-02-05 14:28
    "no effect" is a statement of state whereas "stopping a cog" is a process. The process doesn't change whether the affected cog is already stopped or not. The same things happen. Registers still get cleared. The necessary flip-flops still get forced to a zero state or whatever. If the cog is already stopped, you will see no effect.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-02-05 14:29
    Then there are the zombie cogs, against which a cogstop is completely ineffective! :)

    -Phil
  • RossHRossH Posts: 5,519
    edited 2011-02-05 14:53
    Then there are the zombie cogs, against which a cogstop is completely ineffective! :)

    -Phil

    Dont forget the heisenberg cogs, which can be both stopped and executing at the same time. On those, you must use the catstop command. :smile:

    Ross.
  • Cluso99Cluso99 Posts: 18,069
    edited 2011-02-05 15:27
    The zombie cogs are cogs 8+ :)
  • jazzedjazzed Posts: 11,803
    edited 2011-02-05 17:53
    I thought Heisenberg COGs would be immeasurable because the act of measuring them would change their state. I've seen a few like this recently. ... especially the ones that were stopped - which I just had to assume was the case but couldn't really tell other than knowing the practical effects of having a stopped COG.
  • RossHRossH Posts: 5,519
    edited 2011-02-05 18:03
    jazzed wrote: »
    I thought Heisenberg COGs would be immeasurable because the act of measuring them would change their state. I've seen a few like this recently. ... especially the ones that were stopped - which I just had to assume was the case but couldn't really tell other than knowing the practical effects of having a stopped COG.

    The heisenberg cogs are quantum computing devices, making the Propeller the most powerful computing device in the known universe.

    Unfortunately, the quantum wave function collapses whenever a hub or pin instruction is executed, so no-one has ever been able to get an answer out of them. But there are rumours that if you connect a speaker in to the appropriate pins, you can occasionally hear a very faint "miaow!"

    Ross.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2011-02-05 18:21
    The title of this thread get more appropriate with each post. Good job on staying on topic!
  • jazzedjazzed Posts: 11,803
    edited 2011-02-05 19:17
    I guess I should apologize for not starting on topic :D
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-02-06 02:43
    jazzed wrote:
    I guess I should apologize for not starting on topic
    Yes, by not doing so, you've irreversibly ripped the fabric of causality, and we shall surely be sucked into a giant wormhole as a consequence. Thanks a hackuva lot!

    -Phil
Sign In or Register to comment.