Exemplo n.º 1
0
Arquivo: linkit.c Projeto: devansc/OS
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);
}
Exemplo n.º 2
0
Arquivo: main.c Projeto: devansc/OS
int main(int argc, char *argv[]){
  long i;

  printf("Creating LWPS\n");

  /* spawn a number of individual LWPs */
  for(i=1;i<=5;i++) {
    lwp_create((lwpfun)indentnum,(void*)i,INITIALSTACK);
  }

  printf("Setting the scheduler.\n");
  lwp_set_scheduler(AltRoundRobin);
  printf("Launching LWPS\n");
  lwp_start();                     /* returns when the last lwp exits */

  printf("Back from LWPS.\n");
  return 0;
}
Exemplo n.º 3
0
int main(int argc, char *argv[]){
  long i;

  srandom(0);                   /* so it's repeatable */
  lwp_set_scheduler(Random);

  printf("Launching LWPS\n");

  /* spawn a number of individual LWPs */
  for(i=1;i<=NUMTHREADS;i++) {
    lwp_create((lwpfun)indentnum,(void*)i,INITIALSTACK);
  }

  lwp_start();                     /* returns when the last lwp exits */

  printf("Back from LWPS.\n");
  return 0;
}
Exemplo n.º 4
0
int main(int argc, char *argv[]){
  int i;

  for (i=1;i<argc;i++) {                /* check options */
    if ( !strcmp(argv[i],"-z") ){ /* -z = schedule element 0 */
      lwp_set_scheduler(AlwaysZero);
    } else {
      fprintf(stderr,"%s: unknown option\n",argv[i]);
      exit(-1);
    }
  }

  printf("Launching LWPS\n");

  /* spawn a number of individual LWPs */
  for(i=1;i<=5;i++) {
    new_lwp((lwpfun)indentnum,(void*)i,INITIALSTACK);
  }

  lwp_start();                     /* returns when the last lwp exits */

  printf("Back from LWPS.\n");
  return 0;
}