cogstart in propeller.h vs _start_cog_thread in thread.h
DavidZemon
Posts: 2,973
in Propeller 1
What's the difference between cogstart in propeller.h vs _start_cog_thread in thread.h? Aside from the function signatures which I can read for myself.
Comments
cogstart from propeller.h uses the provided stack to create the _thread_state variable instance and then invokes _start_cog_thread. It also saves the user from having to calculate the address of the top of the stack. All-in-all, it looks like it should always be favored over _start_cog_thread directly.
cogstart contains a simple stack size check and, if the stack isn't large enough, will error out by returning -1 if it isn't large enough. So, for a simple cog that blinks an LED, 45 should be fine (I use 64 in PropWare's examples because I like powers of 2) and more complicated functions you'll want to increase simply by trial and error.