4x5n
10-11-2011, 02:22 AM
I've been thinking about a method to allow various objects and methods running on different cogs to pass information back and forth. My thought is to have have the initial method/object reserve an array as global memory and then pass the address of the array to the different objects. This way an object can pass data to other objects.
I'm doing something like it already in other short programs I've written. Rather then having an objects stop method simply cut out a method at it's knees by stopping a cog and then having to clean up the mess I have the stop method set a "stop" variable that's global to the object which is "monitored" by the other methods in the object and when set it's set causes the method to shut itself down and when it's done shuts down the cog.
My question is if during the run of the "program" I stop cog 0 and use it for something else does the memory it reserved become available for other use?
I'm doing something like it already in other short programs I've written. Rather then having an objects stop method simply cut out a method at it's knees by stopping a cog and then having to clean up the mess I have the stop method set a "stop" variable that's global to the object which is "monitored" by the other methods in the object and when set it's set causes the method to shut itself down and when it's done shuts down the cog.
My question is if during the run of the "program" I stop cog 0 and use it for something else does the memory it reserved become available for other use?