00001 // See the end of this file for license information. 00002 00003 #ifndef TORSION_TASK_H 00004 #define TORSION_TASK_H 00005 00006 #include "list.h" 00007 #include "types.h" 00008 #include "arch.h" 00009 class Task; 00010 #include "semaphore.h" 00011 00012 typedef void (*Task_func)(void); 00013 00014 typedef enum { READY, RUNNING, WAITING, DEAD } Task_state; 00015 00022 00023 class Task : public List_node { 00024 public: 00025 Task_state curr_state; 00026 Task_state next_state; 00027 unsigned volatile stack; 00028 Semaphore* semaphore; 00029 00031 static Task* 00032 create(); 00033 00035 void 00036 init(); 00037 }; 00038 00039 #endif 00040 00041 /* Torsion Operating System, Copyright (C) 2000-2004 Dan Helfman 00042 * 00043 * This program is free software; you can redistribute it and/or modify it 00044 * under the terms of the GNU General Public License as published by the 00045 * Free Software Foundation; either version 2 of the License, or (at your 00046 * option) any later version. 00047 * 00048 * This program is distributed in the hope that it will be useful, but 00049 * WITHOUT ANY WARRANTY; without even the implied warranty of 00050 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00051 * General Public License for more details (in the COPYING file). 00052 * 00053 * You should have received a copy of the GNU General Public License along 00054 * with this program; if not, write to the Free Software Foundation, Inc., 00055 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00056 */
Torsion Operating System, Copyright (C) 2000-2004 Dan Helfman