J
JS
When setjmp is called how can the if statement evaluate to true or false
when setjmp only returns 0 or non-zero?
struct pcb {
void *(*start_routine) (void *);
void *arg;
jmp_buf state;
int stack[1024];
};
struct pcb *pcb_pointer;
pcb_pointer = (struct pcb *) malloc(sizeof(struct pcb));
if(setjmp(pcb_pointer->state)) {
current->start_routine(current->arg);
printf("Thread returned\n");
exit(0);
}
when setjmp only returns 0 or non-zero?
struct pcb {
void *(*start_routine) (void *);
void *arg;
jmp_buf state;
int stack[1024];
};
struct pcb *pcb_pointer;
pcb_pointer = (struct pcb *) malloc(sizeof(struct pcb));
if(setjmp(pcb_pointer->state)) {
current->start_routine(current->arg);
printf("Thread returned\n");
exit(0);
}