|
[ source navigation ] [ diff markup ] [ identifier search ] [ general search ] |
|||
|
001 /* Copyright (C) 2004 David Decotigny 002 003 This program is free software; you can redistribute it and/or 004 modify it under the terms of the GNU General Public License 005 as published by the Free Software Foundation; either version 2 006 of the License, or (at your option) any later version. 007 008 This program is distributed in the hope that it will be useful, 009 but WITHOUT ANY WARRANTY; without even the implied warranty of 010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 011 GNU General Public License for more details. 012 013 You should have received a copy of the GNU General Public License 014 along with this program; if not, write to the Free Software 015 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 016 USA. 017 */ 018 #ifndef _SOS_SCHED_H_ 019 #define _SOS_SCHED_H_ 020 021 022 /** 023 * @file sched.h 024 * 025 * A basic scheduler with simple FIFO threads' ordering. 026 * 027 * The functions below manage CPU queues, and are NEVER responsible 028 * for context switches (see thread.h for that) or synchronizations 029 * (see kwaitq.h or the higher levels primitives [mutex, semaphore, 030 * ...] for that). 031 * 032 * @note IMPORTANT: all the functions below are meant to be called 033 * ONLY by the thread/timer/kwaitq subsystems. DO NOT use them 034 * directly from anywhere else: use ONLY the thread/kwaitq functions! 035 * If you still want to call them directly despite this disclaimer, 036 * simply disable interrupts before clling them. 037 */ 038 039 #include <sos/errno.h> 040 041 042 #include <sos/thread.h> 043 044 045 /** 046 * Initialize the scheduler 047 * 048 * @note: The use of this function is RESERVED 049 */ 050 sos_ret_t sos_sched_subsystem_setup(); 051 052 053 /** 054 * Mark the given thread as ready 055 * 056 * @note: The use of this function is RESERVED 057 */ 058 sos_ret_t sos_sched_set_ready(struct sos_thread * thr); 059 060 061 /** 062 * Return the identifier of the next thread to run. Also removes it 063 * from the ready list, but does NOT set is as current_thread ! 064 * 065 * @param current_thread TCB of the thread calling the function 066 * 067 * @param do_yield When TRUE, put the current executing thread at the 068 * end of the ready list. Otherwise it is kept at the head of it. 069 * 070 * @note: The use of this function is RESERVED 071 */ 072 struct sos_thread * sos_reschedule(struct sos_thread * current_thread, 073 sos_bool_t do_yield); 074 075 #endif /* _SOS_WAITQUEUE_H_ */
[ source navigation ] | [ diff markup ] | [ identifier search ] | [ general search ] |