root/Whitix/trunk/include/sched.h

Revision 1668, 2.3 KB (checked in by mwhitworth, 3 years ago)

Merge in changes from keobject.

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;
32struct KeObject;
33
34extern struct Process* current;
35extern struct Thread* currThread,*prevThread;
36extern struct Thread* lastMathThread;
37
38int ThrInit();
39void ThrSchedule();
40struct Process* ThrCreateProcess(char* name);
41
42/* stackP is not applicable to kernel threads. */
43#define ThrCreateKernelThread(address) (ThrCreateThread(NULL,(DWORD)(address),false,0, NULL))
44#define ThrCreateKernelThreadArg(address, arg) (ThrCreateThread(NULL, (DWORD)(address), false, 0, (arg)))
45
46struct Thread* ThrCreateThread(struct Process* parent,DWORD entry,int user,DWORD stackP, void* argument);
47void ThrStartThread(struct Thread* thread);
48void ThrProcessExit(int returnCode);
49void ThrSetPriority(struct Thread* thread, int priority);
50void ThrSuspendThread(struct Thread* thread);
51void ThrResumeThread(struct Thread* thread);
52char* ThrGetProcName(DWORD pid);
53void ThrFreeThread(struct Thread* thread);
54void ThrFreeProcess(struct KeObject* object);
55void ThrIdleFunc();
56int ThrDoExitThread();
57
58/***********************************************************************
59 *
60 * PRIORITY DEFINES
61 *
62 * This is where the scheduler's tweakables are located.
63 *
64 ***********************************************************************/
65
66#define PRIORITY_NONE           0       /* Lowest priority available */
67#define PRIORITY_DEFAULT        16      /* Default priority of a new process */
68#define PRIORITY_TOP            32      /* Top priority process, will take up most CPU time */
69
70#endif
Note: See TracBrowser for help on using the browser.