xref: /haiku/headers/private/system/thread_defs.h (revision b06a48ab8f30b45916a9c157b992827779182163)
1 /*
2  * Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _SYSTEM_THREAD_DEFS_H
6 #define _SYSTEM_THREAD_DEFS_H
7 
8 #include <OS.h>
9 
10 
11 #define THREAD_RETURN_EXIT			0x1
12 #define THREAD_RETURN_INTERRUPTED	0x2
13 #define THREAD_STOPPED				0x3
14 #define THREAD_CONTINUED			0x4
15 
16 /** Size of the stack given to teams in user space */
17 #define USER_STACK_GUARD_PAGES		4								// 16 kB
18 #define USER_MAIN_THREAD_STACK_SIZE	(16 * 1024 * 1024 \
19 						- USER_STACK_GUARD_PAGES * B_PAGE_SIZE)		// 16 MB
20 #define USER_STACK_SIZE				(256 * 1024	\
21 						- USER_STACK_GUARD_PAGES * B_PAGE_SIZE)		// 256 kB
22 #define MIN_USER_STACK_SIZE			(4 * 1024)						// 4 KB
23 #define MAX_USER_STACK_SIZE			(16 * 1024 * 1024 \
24 						- USER_STACK_GUARD_PAGES * B_PAGE_SIZE)		// 16 MB
25 
26 
27 struct thread_creation_attributes {
28 	int32 (*entry)(thread_func, void *);
29 	const char*	name;
30 	int32		priority;
31 	void*		args1;
32 	void*		args2;
33 	void*		stack_address;
34 	size_t		stack_size;
35 
36 	// when calling from kernel only
37 	team_id		team;
38 	thread_id	thread;
39 };
40 
41 #endif	/* _SYSTEM_THREAD_DEFS_H */
42