* Changed _kern_spawn_thread() and create_thread(): Instead of individual

arguments they get a single thread_creation_attributes structure now.
* Added stack_address and stack_size to thread_creation_attributes,
  which allow to specify the stack size or the stack to be used for the
  new user thread.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25389 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2008-05-09 01:32:36 +00:00
parent 6eea7aabb8
commit 4c49f2056b
5 changed files with 124 additions and 44 deletions
+2
View File
@@ -37,6 +37,8 @@
/** Size of the stack given to teams in user space */
#define USER_MAIN_THREAD_STACK_SIZE (16 * 1024 * 1024) // 16 MB
#define USER_STACK_SIZE (256 * 1024) // 256 kB
#define MIN_USER_STACK_SIZE (4 * 1024) // 4 KB
#define MAX_USER_STACK_SIZE (16 * 1024 * 1024) // 16 MB
#define USER_STACK_GUARD_PAGES 4 // 16 kB
/** Size of the environmental variables space for a process */
+3 -2
View File
@@ -33,6 +33,7 @@ struct stat;
struct disk_device_job_progress_info;
struct partitionable_space_data;
struct thread_creation_attributes;
struct user_disk_device_data;
struct user_disk_device_job_info;
struct user_disk_system_info;
@@ -107,8 +108,8 @@ extern pid_t _kern_setpgid(pid_t process, pid_t group);
extern pid_t _kern_setsid(void);
extern status_t _kern_change_root(const char *path);
extern thread_id _kern_spawn_thread(int32 (*func)(thread_func, void *),
const char *name, int32 priority, void *data1, void *data2);
extern thread_id _kern_spawn_thread(
struct thread_creation_attributes* attributes);
extern thread_id _kern_find_thread(const char *name);
extern status_t _kern_suspend_thread(thread_id thread);
extern status_t _kern_resume_thread(thread_id thread);
+16 -1
View File
@@ -20,6 +20,21 @@
struct kernel_args;
struct select_info;
struct thread_creation_attributes;
struct thread_creation_attributes {
int32 (*entry)(thread_func, void *);
const char* name;
int32 priority;
void* args1;
void* args2;
void* stack_address;
size_t stack_size;
// when calling kernel only
team_id team;
thread_id thread;
};
#ifdef __cplusplus
@@ -89,7 +104,7 @@ status_t _user_rename_thread(thread_id thread, const char *name);
status_t _user_suspend_thread(thread_id thread);
status_t _user_resume_thread(thread_id thread);
status_t _user_rename_thread(thread_id thread, const char *name);
thread_id _user_spawn_thread(thread_entry_func entry, const char *name, int32 priority, void *arg1, void *arg2);
thread_id _user_spawn_thread(struct thread_creation_attributes* attributes);
status_t _user_wait_for_thread(thread_id id, status_t *_returnCode);
status_t _user_snooze_etc(bigtime_t timeout, int timebase, uint32 flags);
status_t _user_kill_thread(thread_id thread);