root / Whitix / branches / hybrid / include / sched.h

Revision 496, 2.6 kB (checked in by mwhitworth, 4 months ago)

Fix function prototypes.

Line 
1/*  This file is part of Whitix.
2 *
3 *  Whitix is free software; you can redistribute it and/or modify
4 *  it under the terms of the GNU General Public License as published by
5 *  the Free Software Foundation; either version 2 of the License, or
6 *  (at your option) any later version.
7 *
8 *  Whitix is distributed in the hope that it will be useful,
9 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
10 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 *  GNU General Public License for more details.
12 *
13 *  You should have received a copy of the GNU General Public License
14 *  along with Whitix; if not, write to the Free Software
15 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
16 *
17 */
18
19#ifndef SCHED_H
20#define SCHED_H
21
22#include <i386/pit.h>
23#include <llist.h>
24#include <typedefs.h>
25#include <string.h>
26
27extern int tasking;
28extern volatile int thrNeedSchedule;
29
30struct Process;
31struct Thread;
32
33extern struct Process* current;
34extern struct Thread* currThread,*prevThread;
35extern struct Thread* lastMathThread;
36
37int ThrInit();
38void ThrSchedule();
39struct Process* ThrCreateProcess(char* name);
40
41/* stackP is not applicable to kernel threads. */
42#define ThrCreateKernelThread(address) (ThrCreateThread(NULL,(DWORD)(address),false,0, NULL))
43
44struct Thread* ThrCreateThread(struct Process* parent,DWORD entry,int user,DWORD stackP, void* argument);
45void ThrStartThread(struct Thread* thread);
46void ThrProcessExit(int returnCode);
47void ThrSetPriority(struct Thread* thread, int priority);
48void ThrSuspendThread(struct Thread* thread);
49void ThrResumeThread(struct Thread* thread);
50char* ThrGetProcName(DWORD pid);
51void ThrFreeThread(struct Thread* thread);
52void ThrFreeProcess(struct Process* process);
53void ThrIdleFunc();
54
55/* Thread macros go here */
56#define ThrGetThread(thread)            ((thread)->refs++)
57#define ThrReleaseThread(thread) \
58do { (thread)->refs--;  if ((thread)->refs <= 0) ThrFreeThread((thread)); } while(0)
59
60#define ThrGetProcess(process)          ((process)->refs++)
61#define ThrReleaseProcess(process) \
62do { (process)->refs--; if ((process)->refs <= 0) ThrFreeProcess((process)); } while(0)
63
64/***********************************************************************
65 *
66 * PRIORITY DEFINES
67 *
68 * This is where the scheduler's tweakables are located.
69 *
70 ***********************************************************************/
71
72#define PRIORITY_NONE           0       /* Lowest priority available */
73#define PRIORITY_DEFAULT        16      /* Default priority of a new process */
74#define PRIORITY_TOP            32      /* Top priority process, will take up most CPU time */
75
76#endif
Note: See TracBrowser for help on using the browser.