Annotation of xinu/sys/sleep.c, revision 1.1

1.1     ! root        1: /* sleep.c - sleep */
        !             2: 
        !             3: #include <conf.h>
        !             4: #include <kernel.h>
        !             5: #include <proc.h>
        !             6: #include <q.h>
        !             7: #include <sleep.h>
        !             8: 
        !             9: /*------------------------------------------------------------------------
        !            10:  * sleep  --  delay the calling process n seconds
        !            11:  *------------------------------------------------------------------------
        !            12:  */
        !            13: SYSCALL        sleep(n)
        !            14:        int     n;
        !            15: {
        !            16:        PStype  ps;
        !            17: 
        !            18:        if (n<0 || clkruns==0)
        !            19:                return(SYSERR);
        !            20:        if (n == 0) {
        !            21:                disable(ps);
        !            22:                resched();
        !            23:                restore(ps);
        !            24:                return(OK);
        !            25:        }
        !            26:        while (n >= 1000) {
        !            27:                sleep10(10000);
        !            28:                n -= 1000;
        !            29:        }
        !            30:        if (n > 0)
        !            31:                sleep10(10*n);
        !            32:        return(OK);
        !            33: }

unix.superglobalmegacorp.com

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