Annotation of xinu/sys/test.c, revision 1.1.1.2

1.1.1.2 ! root        1: #include <stdio.h>
        !             2: int workcount = 0;
1.1       root        3: 
                      4: main()
                      5: {
1.1.1.2 ! root        6:   int nwork, work();
1.1       root        7: 
1.1.1.2 ! root        8:   printf("Enter cycles of work to do: ");
        !             9:   scanf("%d",&nwork);
        !            10:   resume(create(work,1000,20,"worker",1,nwork));
        !            11:   while (1)
        !            12:     {
        !            13:       getc(CONSOLE);           /* wait for <CR> from keyboard */
        !            14:       printf("worker at # %d\n",workcount);
        !            15:     }
        !            16: }
1.1       root       17: 
1.1.1.2 ! root       18: work(ncycles)
        !            19: {
        !            20:   int i;
        !            21:   printf("Worker starting\n");
        !            22:   for (i=1;i<=ncycles;i++)
        !            23:     {
        !            24:       docycle(i);              /* do ith work cycle */
        !            25:       workcount++;             /* count it where parent can see it */
        !            26:     }
        !            27: }
1.1       root       28: 
1.1.1.2 ! root       29: docycle(n)
        !            30: int n;
        !            31: {
        !            32:   int i;
        !            33:   for (i=0;i<n;i++);
1.1       root       34: }

unix.superglobalmegacorp.com

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