comparison kernel/process.c3 @ 296:9417caea2eb3

Directorized some backend files
author Windel Bouwman
date Sun, 01 Dec 2013 13:36:58 +0100
parents 917eab04b8b7
children 158068af716c
comparison
equal deleted inserted replaced
295:917eab04b8b7 296:9417caea2eb3
1 module process; 1 module process;
2 import memory; 2 import memory;
3 import kernel; 3 import kernel;
4 4
5 // process type definition: 5 // process type definition:
6 typedef struct { 6 type struct {
7 int id; 7 int id;
8 int status; 8 int status;
9 } process_t; 9 } process_t;
10 10
11 // Or, use this list structure: 11 // Or, use this list structure:
12 List<process_t> procs; 12 // List<process_t> procs;
13 13
14 // init is the root of all processes: 14 // init is the root of all processes:
15 var process_t* init = 0; 15 var process_t* init = 0;
16 var int next_pid = 0; 16 var int next_pid = 0;
17 17
18 public function void init() 18 function void init()
19 { 19 {
20 next_pid = 0; 20 next_pid = 0;
21 init = Create(); 21 init = Create();
22 } 22 }
23 23
24 /* 24 /*
25 Create a new process. 25 Create a new process.
26 */ 26 */
27 public func process_t* Create() 27 function process_t* Create()
28 { 28 {
29 process_t* p = memory.Alloc(sizeof(process_t)); 29 process_t* p = memory.Alloc(sizeof(process_t));
30 p->id = next_pid; 30 p->id = next_pid;
31 next_pid++; 31 next_pid++;
32 return p; 32 return p;