[BACK]Return to sched.h CVS log [TXT][DIR] Up to [local] / prex-old / sys / include

Annotation of prex-old/sys/include/sched.h, Revision 1.1

1.1     ! nbrk        1: /*-
        !             2:  * Copyright (c) 2005-2007, Kohsuke Ohtani
        !             3:  * All rights reserved.
        !             4:  *
        !             5:  * Redistribution and use in source and binary forms, with or without
        !             6:  * modification, are permitted provided that the following conditions
        !             7:  * are met:
        !             8:  * 1. Redistributions of source code must retain the above copyright
        !             9:  *    notice, this list of conditions and the following disclaimer.
        !            10:  * 2. Redistributions in binary form must reproduce the above copyright
        !            11:  *    notice, this list of conditions and the following disclaimer in the
        !            12:  *    documentation and/or other materials provided with the distribution.
        !            13:  * 3. Neither the name of the author nor the names of any co-contributors
        !            14:  *    may be used to endorse or promote products derived from this software
        !            15:  *    without specific prior written permission.
        !            16:  *
        !            17:  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
        !            18:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        !            19:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
        !            20:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
        !            21:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        !            22:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
        !            23:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
        !            24:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
        !            25:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
        !            26:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
        !            27:  * SUCH DAMAGE.
        !            28:  */
        !            29:
        !            30: #ifndef _SCHED_H
        !            31: #define _SCHED_H
        !            32:
        !            33: #include <event.h>
        !            34: #include <thread.h>
        !            35:
        !            36: /*
        !            37:  * Scheduling policies defined by IEEE Std 1003.1-2001
        !            38:  */
        !            39: #define SCHED_FIFO     0       /* First in-first out */
        !            40: #define SCHED_RR       1       /* Round robin */
        !            41: #define        SCHED_OTHER     2       /* Another scheduling policy */
        !            42:
        !            43: /*
        !            44:  * Scheduling quantum (Ticks for context switch)
        !            45:  */
        !            46: #define QUANTUM                (CONFIG_TIME_SLICE * HZ / 1000)
        !            47:
        !            48: /*
        !            49:  * DPC (Deferred Procedure Call) object
        !            50:  */
        !            51: struct dpc {
        !            52:        struct queue    link;           /* Linkage on DPC queue */
        !            53:        int             state;
        !            54:        void            (*func)(void *); /* Callback routine */
        !            55:        void            *arg;           /* Argument to pass */
        !            56: };
        !            57:
        !            58: /* state for DPC */
        !            59: #define DPC_FREE       0x4470463f      /* 'DpF?' */
        !            60: #define DPC_PENDING    0x4470503f      /* 'DpP?' */
        !            61:
        !            62: #define sched_sleep(evt)       sched_tsleep((evt), 0)
        !            63:
        !            64: extern int      sched_tsleep(struct event *, u_long);
        !            65: extern void     sched_wakeup(struct event *);
        !            66: extern thread_t         sched_wakeone(struct event *);
        !            67: extern void     sched_unsleep(thread_t, int);
        !            68: extern void     sched_yield(void);
        !            69: extern void     sched_suspend(thread_t);
        !            70: extern void     sched_resume(thread_t);
        !            71: extern void     sched_tick(void);
        !            72: extern void     sched_start(thread_t);
        !            73: extern void     sched_stop(thread_t);
        !            74: extern void     sched_lock(void);
        !            75: extern void     sched_unlock(void);
        !            76: extern int      sched_getprio(thread_t);
        !            77: extern void     sched_setprio(thread_t, int, int);
        !            78: extern int      sched_getpolicy(thread_t);
        !            79: extern int      sched_setpolicy(thread_t, int);
        !            80: extern void     sched_dpc(struct dpc *, void (*)(void *), void *);
        !            81: extern void     sched_init(void);
        !            82:
        !            83: #endif /* !_SCHED_H */

CVSweb