Annotation of xinu/sys/ssclock.c, revision 1.1.1.1

1.1       root        1: /* ssclock.c - stopclk, strtclk */
                      2: 
                      3: #include <conf.h>
                      4: #include <kernel.h>
                      5: #include <proc.h>
                      6: #include <q.h>
                      7: #include <sleep.h>
                      8: 
                      9: /*------------------------------------------------------------------------
                     10:  *  stopclk  --  put the clock in defer mode
                     11:  *------------------------------------------------------------------------
                     12:  */
                     13: stopclk()
                     14: {
                     15:        defclk++;
                     16: }
                     17: 
                     18: /*------------------------------------------------------------------------
                     19:  *  strtclk  --  take the clock out of defer mode
                     20:  *------------------------------------------------------------------------
                     21:  */
                     22: strtclk()
                     23: {
                     24:        PStype ps;
                     25:        int makeup;
                     26:        int next;
                     27: 
                     28:        disable(ps);
                     29:        if ( defclk<=0 || --defclk>0 ) {
                     30:                restore(ps);
                     31:                return;
                     32:        }
                     33:        makeup = clkdiff;
                     34:        preempt -= makeup;
                     35:        clkdiff = 0;
                     36:        if ( slnempty ) {
                     37:                for (next=firstid(clockq) ; 
                     38:                    next < NPROC && q[next].qkey < makeup ;
                     39:                    next=q[next].qnext) {
                     40:                        makeup -= q[next].qkey;
                     41:                        q[next].qkey = 0;
                     42:                }
                     43:                if (next < NPROC)
                     44:                        q[next].qkey -= makeup;
                     45:                wakeup();
                     46:        }
                     47:        if ( preempt <= 0 )
                     48:                resched();
                     49:        restore(ps);
                     50: }

unix.superglobalmegacorp.com

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