Implementing context switch or thread using hi-tech PIC C

Status
Not open for further replies.

johncsl82

Advanced Member level 4
Joined
Aug 16, 2004
Messages
105
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,296
Activity points
925
hi....

is there any simple software context switch out there?
I try freertos, but the code kind of hard to understand.....

I need a simpler version like....

Code:
void t1() {...}
void t2() {...}

boolean contextSwitch(void (*t1)(), void (*t2)())
{
    //code goes here
    //like push all the context (i.e. register, variable, counter... etc etc) to stack
    
}

void main()
{
     while(1)
     {
            contextSwitch(&t1, &t2);
            contextSwitch(&t2, &t1);
     }

}

on the other hand, based on my research, if we implement context switch best to have multi-threading or threading...........

so if there any example, please reply...thank you

Thanks
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…