File:  [XINU] / xinu / sys / test1.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:39:48 2018 UTC (8 years, 2 months ago) by root
Branches: xinu, MAIN
CVS tags: xinu-19910600, HEAD
Xinu for 68000/68010

#include <stdio.h>
int workcount = 0;

main()
{
  int nwork, ch, work();

  printf("Enter cycles of work to do: ");
/*  scanf("%d",&nwork); */
  nwork = 1000;
  ch = getc(CONSOLE);
  printf("Got %c %d\n",ch,nwork);
  resume(create(work,500,20,"worker",1,nwork));
  printf("Parent back from resume of child\n");
  while (1)
    {
      getc(CONSOLE);		/* wait for <CR> from keyboard */
      printf("worker at # %d\n",workcount);
    }
}

work(ncycles)
{
  int i;
  printf("child starting, ncycles=%d...\n",ncycles);
  for (i=1;i<=ncycles;i++)
    {
      docycle(i);		/* do ith work cycle */
      workcount++;		/* count it where parent can see it */
    }
}

docycle(n)
int n;
{
  int i;
  for (i=0;i<n;i++);
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.