In C, multicore function declaration question
twm47099
Posts: 867
In the tutorial C - Functions Multicore Example, the following is used to declare and define the function that is used in the new cog:
void adder(void *par);
I've looked through some of the c-libraries and see the same parameter when starting a function in a new cog. From reading my C text (void *par) is an untyped pointer to par. What does that do in relation to the function in the new cog? Is par a reserved variable name that is used any time a function is started in a different cog? In other words, if I am starting a different function in each of 3 cogs, would I use (void *par) as the parameter for each function?
Related question: Can I pass other parameters to a cog in a function call? If so what does the declaration of the function look like, and is void *par still one of the parameters?
Thanks again
Tom
void adder(void *par);
I've looked through some of the c-libraries and see the same parameter when starting a function in a new cog. From reading my C text (void *par) is an untyped pointer to par. What does that do in relation to the function in the new cog? Is par a reserved variable name that is used any time a function is started in a different cog? In other words, if I am starting a different function in each of 3 cogs, would I use (void *par) as the parameter for each function?
Related question: Can I pass other parameters to a cog in a function call? If so what does the declaration of the function look like, and is void *par still one of the parameters?
Thanks again
Tom
Comments
The name par is not special; it's just a declaration. It can be called "MarilynMonroll" if you like - a most interesting Sushi dish in Rocklin.
Some examples (code has not been test compiled):
Reference: https://sites.google.com/site/propellergcc/documentation/libraries/propeller-h-library#TOC-cogstart
http://www.tymkrs.com/shows/episode/firstc-episode-011/