nckernel
0.1
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
common
include
thread.h
Go to the documentation of this file.
1
11
#define MAX_ENTRY 256
12
#define THREAD_TAG "ncthread"
13
#define THREAD_TAGLEN 9
14
19
struct
file_object_info
{
20
int
size
;
21
const
char
*
path
;
22
int
mode
;
23
};
24
25
struct
file
{
26
struct
object
object
;
27
char
*
buffer
;
28
int
size
;
29
int
offset
;
30
struct
entry
*
ctx
;
31
};
32
33
struct
thread_file_ctx
{
34
struct
object
object
;
35
struct
file
table
[
MAX_ENTRY
];
36
};
37
42
struct
local_tcb
{
43
char
tag
[
THREAD_TAGLEN
];
44
struct
thread
*
tcb_ptr
;
45
};
46
50
struct
thread_attr
{
51
struct
{
52
void
*
addr
;
53
uint32_t
size
;
54
int
is_allocated
;
55
}
stack
;
56
57
int
is_first
;
58
};
59
63
struct
thread
{
64
struct
object
object
;
65
struct
thread
*
parent
;
66
struct
thread
*
root
;
67
struct
list_head
child
;
68
struct
list_head
sibling
;
69
struct
list_head
link
;
70
71
void
*
arch_data
;
72
void
*
user_data
;
73
74
enum
{
75
CREATED
= 0x00,
76
READY
= 0x01,
77
DELETED
= 0x02,
78
RUNNING
= 0x03,
79
SLEEP
= 0x04,
80
ZOMBIE
= 0x05,
81
}
status
;
83
uint32_t
*
esp
;
84
struct
thread_attr
attr
;
85
struct
thread_file_ctx
*
file_ctx
;
86
void
*
sem
;
/* Semaphore pointer */
87
};
88
93
extern
FILE
*
thread_get_stdin
(
void
);
94
99
extern
FILE
*
thread_get_stderr
(
void
);
100
105
extern
FILE
*
thread_get_stdout
(
void
);
106
114
extern
int
thread_create
(
struct
thread
*tcb,
struct
thread_attr
*attr);
115
123
extern
void
thread_set_status
(
struct
thread
*tcb,
int
status);
124
131
extern
int
thread_get_status
(
struct
thread
*tcb);
132
139
extern
unsigned
long
thread_get_stack_pointer
(
struct
thread
*tcb);
140
147
extern
void
*
thread_get_arch_data
(
struct
thread
*tcb);
148
155
extern
void
*
thread_get_user_data
(
struct
thread
*tcb);
156
Generated on Thu Nov 7 2013 02:45:25 for nckernel by
1.8.4