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

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: 
1.1.1.2 ! root        9: #ifdef RTCLOCK
        !            10: 
1.1       root       11: /*------------------------------------------------------------------------
                     12:  *  stopclk  --  put the clock in defer mode
                     13:  *------------------------------------------------------------------------
                     14:  */
                     15: stopclk()
                     16: {
                     17:        defclk++;
                     18: }
                     19: 
                     20: /*------------------------------------------------------------------------
                     21:  *  strtclk  --  take the clock out of defer mode
                     22:  *------------------------------------------------------------------------
                     23:  */
                     24: strtclk()
                     25: {
                     26:        int makeup;
                     27:        int next;
                     28: 
1.1.1.2 ! root       29:        disable();
1.1       root       30:        if ( defclk<=0 || --defclk>0 ) {
1.1.1.2 ! root       31:                restore();
1.1       root       32:                return;
                     33:        }
                     34:        makeup = clkdiff;
                     35:        preempt -= makeup;
                     36:        clkdiff = 0;
                     37:        if ( slnempty ) {
                     38:                for (next=firstid(clockq) ; 
                     39:                    next < NPROC && q[next].qkey < makeup ;
                     40:                    next=q[next].qnext) {
                     41:                        makeup -= q[next].qkey;
                     42:                        q[next].qkey = 0;
                     43:                }
                     44:                if (next < NPROC)
                     45:                        q[next].qkey -= makeup;
                     46:                wakeup();
                     47:        }
                     48:        if ( preempt <= 0 )
1.1.1.2 ! root       49:        resched();
        !            50:        restore();
1.1       root       51: }
1.1.1.2 ! root       52: #endif

unix.superglobalmegacorp.com

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