Hi
I am trying to understand what is Co-Routine in Embedded Programming. Co-routine in program allow multiple entry points for suspending and resuming execution at certain locations. I was looking small example to understand co-routine. I found this code example. but I don't understand how does co-routine work in real program I am trying to make small embedded program please help me to implement co-routine in c program related with embedded task.
I am trying to understand what is Co-Routine in Embedded Programming. Co-routine in program allow multiple entry points for suspending and resuming execution at certain locations. I was looking small example to understand co-routine. I found this code example. but I don't understand how does co-routine work in real program I am trying to make small embedded program please help me to implement co-routine in c program related with embedded task.
C:
#include <setjmp.h>
int main (void)
{
jmp_buf buf1;
if (setjmp(buf1) == 0)
{
/* This code is executed on the first call to setjmp. */
longjmp(buf1, 1);
} else {
/* This code is executed once longjmp is called. */
}
return 0;
}