btrfs: [] on the end of a struct field is a variable length array.
[haiku.git] / headers / private / system / thread_defs.h
blobc2cc881206723785cbaa089740bed03437b01438
1 /*
2 * Copyright 2008-2011, 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
9 #include <pthread.h>
11 #include <OS.h>
14 /** Size of the stack given to teams in user space */
15 #define USER_STACK_GUARD_SIZE (4 * B_PAGE_SIZE) // 16 kB
16 #define MIN_USER_STACK_SIZE (2 * B_PAGE_SIZE) // 8 kB
17 #define MAX_USER_STACK_SIZE (4096 * B_PAGE_SIZE) // 16 MB
18 #define USER_MAIN_THREAD_STACK_SIZE MAX_USER_STACK_SIZE
19 #define USER_STACK_SIZE (64 * B_PAGE_SIZE) // 256 kB
22 // The type of object a thread blocks on (thread::wait::type, set by
23 // thread_prepare_to_block()).
24 enum {
25 THREAD_BLOCK_TYPE_SEMAPHORE = 0,
26 THREAD_BLOCK_TYPE_CONDITION_VARIABLE = 1,
27 THREAD_BLOCK_TYPE_SNOOZE = 2,
28 THREAD_BLOCK_TYPE_SIGNAL = 3,
29 THREAD_BLOCK_TYPE_MUTEX = 4,
30 THREAD_BLOCK_TYPE_RW_LOCK = 5,
32 THREAD_BLOCK_TYPE_OTHER = 9999,
33 THREAD_BLOCK_TYPE_USER_BASE = 10000
37 #define THREAD_CREATION_FLAG_DEFER_SIGNALS 0x01
38 // create the thread with signals deferred, i.e. with
39 // user_thread::defer_signals set to 1
42 struct thread_creation_attributes {
43 int32 (*entry)(void*, void*);
44 const char* name;
45 int32 priority;
46 void* args1;
47 void* args2;
48 void* stack_address;
49 size_t stack_size;
50 size_t guard_size;
51 pthread_t pthread;
52 uint32 flags;
55 #endif /* _SYSTEM_THREAD_DEFS_H */