Skip to content

Commit 9b03b72

Browse files
committed
Remove rt::bookkeeping
This commit removes the runtime bookkeeping previously used to ensure that all Rust tasks were joined before the runtime was shut down. This functionality will be replaced by an RAII style `Thread` API, that will also offer a detached mode. Since this changes the semantics of shutdown, it is a: [breaking-change]
1 parent c009bfd commit 9b03b72

File tree

4 files changed

+1
-72
lines changed

4 files changed

+1
-72
lines changed

src/libstd/rt/bookkeeping.rs

-61
This file was deleted.

src/libstd/rt/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ pub mod mutex;
7373
pub mod thread;
7474
pub mod exclusive;
7575
pub mod util;
76-
pub mod bookkeeping;
7776
pub mod local;
7877
pub mod task;
7978
pub mod unwind;
@@ -207,7 +206,6 @@ pub fn at_exit(f: proc():Send) {
207206
/// Invoking cleanup while portions of the runtime are still in use may cause
208207
/// undefined behavior.
209208
pub unsafe fn cleanup() {
210-
bookkeeping::wait_for_other_tasks();
211209
args::cleanup();
212210
thread::cleanup();
213211
local_ptr::cleanup();

src/libstd/rt/task.rs

-7
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ use str::SendStr;
2929
use thunk::Thunk;
3030

3131
use rt;
32-
use rt::bookkeeping;
3332
use rt::mutex::NativeMutex;
3433
use rt::local::Local;
3534
use rt::thread::{mod, Thread};
@@ -132,11 +131,6 @@ impl Task {
132131

133132
let stack = stack_size.unwrap_or(rt::min_stack());
134133

135-
// Note that this increment must happen *before* the spawn in order to
136-
// guarantee that if this task exits it will always end up waiting for
137-
// the spawned task to exit.
138-
let token = bookkeeping::increment();
139-
140134
// Spawning a new OS thread guarantees that __morestack will never get
141135
// triggered, but we must manually set up the actual stack bounds once
142136
// this function starts executing. This raises the lower limit by a bit
@@ -156,7 +150,6 @@ impl Task {
156150

157151
let mut f = Some(f);
158152
drop(task.run(|| { f.take().unwrap().invoke(()) }).destroy());
159-
drop(token);
160153
})
161154
}
162155

src/libstd/sys/common/helper_thread.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use prelude::*;
2525
use cell::UnsafeCell;
2626
use mem;
2727
use sync::{StaticMutex, StaticCondvar};
28-
use rt::{mod, bookkeeping};
28+
use rt;
2929
use sys::helper_signal;
3030

3131
use task;
@@ -83,7 +83,6 @@ impl<M: Send> Helper<M> {
8383

8484
let t = f();
8585
task::spawn(move |:| {
86-
bookkeeping::decrement();
8786
helper(receive, rx, t);
8887
let _g = self.lock.lock();
8988
*self.shutdown.get() = true;

0 commit comments

Comments
 (0)