Exemple #1
0
int main(int argc, char *argv[]){
  if ( argc == -1 ) {
    /* can't happen, but the linker doesn't know it.  */
    /* these are all the required external symbols */
    lwp_create(NULL,NULL,0);
    lwp_exit();
    lwp_yield();
    lwp_start();
    lwp_stop();
    lwp_set_scheduler(NULL);
  }
  printf("Linked successfully.\n");
  exit(0);
}
Exemple #2
0
/*
 * lwp_exit
 *
 * we build
 */
void lwp_exit() {
    lwp_procs--;
    /* saved into global so we can access after sp changes */
    stackToFree = lwp_ptable[lwp_running].stack;
    if (lwp_procs == 0) {
        SetSP(original_stack_pointer);
        /* free the stack of the last lwp */
        freeStack();
        lwp_stop();
    }
    /* cleanup sets new running proc */
    /* and it accounts for the missing proc */
    cleanup(); 

    /*SetSP(original_stack_pointer);*/
    freeStack();
    SetSP(lwp_ptable[lwp_running].sp);
    RESTORE_STATE();
    return;
}