* For each userland team the kernel creates an area in the userland
address space that is fully locked and marked B_KERNEL_AREA. It can thus be accessed by the kernel without additional checks. * For each userland thread we do create a user_thread structure in that area. The structure is accessible from userland via TLS, using the private get_user_thread() function. * Introduced private userland functions [un]defer_signals(). They can be used to cheaply disable/re-enable signal delivery. They use the user_thread::defer_signals/pending_signals fields which are checked/updated by the kernel. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25451 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -444,7 +444,16 @@ create_thread(thread_creation_attributes& attributes, bool kernel)
|
||||
GRAB_TEAM_LOCK();
|
||||
// look at the team, make sure it's not being deleted
|
||||
team = team_get_team_struct_locked(attributes.team);
|
||||
if (team != NULL && team->state != TEAM_STATE_DEATH) {
|
||||
|
||||
if (team == NULL || team->state == TEAM_STATE_DEATH)
|
||||
abort = true;
|
||||
|
||||
if (!abort && !kernel) {
|
||||
thread->user_thread = team_allocate_user_thread(team);
|
||||
abort = thread->user_thread == NULL;
|
||||
}
|
||||
|
||||
if (!abort) {
|
||||
// Debug the new thread, if the parent thread required that (see above),
|
||||
// or the respective global team debug flag is set. But only, if a
|
||||
// debugger is installed for the team.
|
||||
@@ -457,8 +466,7 @@ create_thread(thread_creation_attributes& attributes, bool kernel)
|
||||
}
|
||||
|
||||
insert_thread_into_team(team, thread);
|
||||
} else
|
||||
abort = true;
|
||||
}
|
||||
|
||||
RELEASE_TEAM_LOCK();
|
||||
if (abort) {
|
||||
@@ -1407,8 +1415,10 @@ thread_exit(void)
|
||||
if (team->main_thread == thread) {
|
||||
// this was the main thread in this team, so we will delete that as well
|
||||
deleteTeam = true;
|
||||
} else
|
||||
} else {
|
||||
threadDeathEntry = (death_entry*)malloc(sizeof(death_entry));
|
||||
team_free_user_thread(thread);
|
||||
}
|
||||
|
||||
// remove this thread from the current team and add it to the kernel
|
||||
// put the thread into the kernel team until it dies
|
||||
@@ -2937,4 +2947,3 @@ _user_setrlimit(int resource, const struct rlimit *userResourceLimit)
|
||||
|
||||
return common_setrlimit(resource, &resourceLimit);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user