Revise std::thread API to join by default
This commit is part of a series that introduces a `std::thread` API to replace `std::task`. In the new API, `spawn` returns a `JoinGuard`, which by default will join the spawned thread when dropped. It can also be used to join explicitly at any time, returning the thread's result. Alternatively, the spawned thread can be explicitly detached (so no join takes place). As part of this change, Rust processes now terminate when the main thread exits, even if other detached threads are still running, moving Rust closer to standard threading models. This new behavior may break code that was relying on the previously implicit join-all. In addition to the above, the new thread API also offers some built-in support for building blocking abstractions in user space; see the module doc for details. Closes #18000 [breaking-change]
This commit is contained in:
@@ -34,7 +34,7 @@ impl Drop for Handler {
|
||||
// It returns the guard page of the current task or 0 if that
|
||||
// guard page doesn't exist. None is returned if there's currently
|
||||
// no local task.
|
||||
unsafe fn get_task_guard_page() -> Option<uint> {
|
||||
unsafe fn get_task_guard_page() -> uint {
|
||||
thread_info::stack_guard()
|
||||
}
|
||||
|
||||
@@ -55,9 +55,7 @@ extern "system" fn vectored_handler(ExceptionInfo: *mut EXCEPTION_POINTERS) -> L
|
||||
// however stack checks by limit should be disabled on Windows
|
||||
stack::record_sp_limit(0);
|
||||
|
||||
if get_task_guard_page().is_some() {
|
||||
report_overflow();
|
||||
}
|
||||
report_overflow();
|
||||
|
||||
EXCEPTION_CONTINUE_SEARCH
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user