Asynchronous function call in Spin language?
Carvtum
Posts: 2
Hi
Is there a way to implement an asynchronous call from one object to another (located in an other Cog) so that the call will return immediately, while the called object starts working with the initiated job parallel with the caller. In other words how do you implement a "fork" with the Spin language?
Sorry, I am new in Spin and could not find an example for this kind of use of the spin language.
Is there a way to implement an asynchronous call from one object to another (located in an other Cog) so that the call will return immediately, while the called object starts working with the initiated job parallel with the caller. In other words how do you implement a "fork" with the Spin language?
Sorry, I am new in Spin and could not find an example for this kind of use of the spin language.
Comments
There is an example in the description of either COGINIT or COGNEW.
You can call either with the name of a function and one argument (address) and the address of a stack range to use.
The size of the required stack depends on the nesting of subroutines called from the aobj.myfunc function and the number of local variables of each. There is no stack checking, so it's all your job to give it enough room.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
He died at the console of hunger and thirst.
Next day he was buried. Face down, nine edge first.
Post Edited (pullmoll) : 3/30/2010 1:31:52 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Composite NTSC sprite driver: Forum
NTSC & PAL driver templates: ObEx Forum
OnePinTVText driver: ObEx Forum
you can have ONE object using all eight cogs
or you can have n objects using just one cog and every mixture inbetween.
here is a short democode to show how ONE object can use two cogs and how then the two cogs work independent from each other
manipulating one and the same variable
best regards
Stefan