Back to home page

Quest Cross Reference

 
 

    


Warning, cross-references for /kernel/sysprogs/spinner.c need to be fixed.

0001 /*                    The Quest Operating System
0002  *  Copyright (C) 2005-2010  Richard West, Boston University
0003  *
0004  *  This program is free software: you can redistribute it and/or modify
0005  *  it under the terms of the GNU General Public License as published by
0006  *  the Free Software Foundation, either version 3 of the License, or
0007  *  (at your option) any later version.
0008  *
0009  *  This program is distributed in the hope that it will be useful,
0010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0012  *  GNU General Public License for more details.
0013  *
0014  *  You should have received a copy of the GNU General Public License
0015  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
0016  */
0017 
0018 #include "syscall.h"
0019 
0020 #define NUM_THREADS 4
0021 
0022 void
0023 child (int idx)
0024 {
0025   unsigned long i = 0;
0026   char ch;
0027   if (idx <= 9)
0028     ch = idx + '0';
0029   else
0030     ch = (idx - 10) + 'A';
0031   for (;;) {
0032     if (!(i & 0xFFFFF)) {
0033       putchar (ch);
0034     }
0035     i++;
0036   }
0037 }
0038 
0039 void
0040 _start ()
0041 {
0042   int pid[NUM_THREADS];
0043   int i;
0044 
0045   for (i=1; i<NUM_THREADS; i++) {
0046     if ((pid[i]=fork ()) == 0) {
0047       child (i);
0048     }
0049   }
0050   child (0);
0051 }
0052 
0053 /*
0054  * Local Variables:
0055  * indent-tabs-mode: nil
0056  * mode: C
0057  * c-file-style: "gnu"
0058  * c-basic-offset: 2
0059  * End:
0060  */
0061 
0062 /* vi: set et sw=2 sts=2: */