Which cog runs?
pacman
Posts: 327
Just thinking (and I'm on site in another state so I don't have acces to all my usual documentation). So I'll ask the " 'sperts "
Lets say that cog0 starts a seperate process (in cog1). The new process is basically a repeat loop.
Now if cog0 references a function of the new cog1 (cog0var := cog1.value) where does that 'code' run?
Does cog1 pause it's repeat loop and service the request from cog0? or does cog0 run the code in cog1? or does a whole new cog start (invisibly) run the code in cog1 and pass the value back to cog0 (and then 'disappear')?
Thanks in advance
Lets say that cog0 starts a seperate process (in cog1). The new process is basically a repeat loop.
Now if cog0 references a function of the new cog1 (cog0var := cog1.value) where does that 'code' run?
Does cog1 pause it's repeat loop and service the request from cog0? or does cog0 run the code in cog1? or does a whole new cog start (invisibly) run the code in cog1 and pass the value back to cog0 (and then 'disappear')?
Thanks in advance
Comments
In PASM cog0 does not have access to cog1 code.
In SPIN all code is global because it is stored in the hub not in the cog.
Maybe I'm just not understanding the question correctly ???
Bean
When you call a method in an child object your calling cog is running the code of that method. In your example cog0 is executing the code of that method and cog1 continues doing whatever it was doing.
It matters not what other cogs are running what ever methods in that child object. Or if there are no cogs executing anything else.
If there is some other cog running a method in that child object it knows nothing about you calling any other methods in the object. It just continues on it's merry way.
Of course now your two cogs are probably exchanging data through the variables in that child object.
Thanks Heater. That answers it.