Skip to content

Commit

Permalink
Remove rt::bookkeeping
Browse files Browse the repository at this point in the history
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]
  • Loading branch information
aturon committed Dec 19, 2014
1 parent c009bfd commit 9b03b72
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 72 deletions.
61 changes: 0 additions & 61 deletions src/libstd/rt/bookkeeping.rs

This file was deleted.

2 changes: 0 additions & 2 deletions src/libstd/rt/mod.rs
Expand Up @@ -73,7 +73,6 @@ pub mod mutex;
pub mod thread;
pub mod exclusive;
pub mod util;
pub mod bookkeeping;
pub mod local;
pub mod task;
pub mod unwind;
Expand Down Expand Up @@ -207,7 +206,6 @@ pub fn at_exit(f: proc():Send) {
/// Invoking cleanup while portions of the runtime are still in use may cause
/// undefined behavior.
pub unsafe fn cleanup() {
bookkeeping::wait_for_other_tasks();
args::cleanup();
thread::cleanup();
local_ptr::cleanup();
Expand Down
7 changes: 0 additions & 7 deletions src/libstd/rt/task.rs
Expand Up @@ -29,7 +29,6 @@ use str::SendStr;
use thunk::Thunk;

use rt;
use rt::bookkeeping;
use rt::mutex::NativeMutex;
use rt::local::Local;
use rt::thread::{mod, Thread};
Expand Down Expand Up @@ -132,11 +131,6 @@ impl Task {

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

// Note that this increment must happen *before* the spawn in order to
// guarantee that if this task exits it will always end up waiting for
// the spawned task to exit.
let token = bookkeeping::increment();

// Spawning a new OS thread guarantees that __morestack will never get
// triggered, but we must manually set up the actual stack bounds once
// this function starts executing. This raises the lower limit by a bit
Expand All @@ -156,7 +150,6 @@ impl Task {

let mut f = Some(f);
drop(task.run(|| { f.take().unwrap().invoke(()) }).destroy());
drop(token);
})
}

Expand Down
3 changes: 1 addition & 2 deletions src/libstd/sys/common/helper_thread.rs
Expand Up @@ -25,7 +25,7 @@ use prelude::*;
use cell::UnsafeCell;
use mem;
use sync::{StaticMutex, StaticCondvar};
use rt::{mod, bookkeeping};
use rt;
use sys::helper_signal;

use task;
Expand Down Expand Up @@ -83,7 +83,6 @@ impl<M: Send> Helper<M> {

let t = f();
task::spawn(move |:| {
bookkeeping::decrement();
helper(receive, rx, t);
let _g = self.lock.lock();
*self.shutdown.get() = true;
Expand Down

0 comments on commit 9b03b72

Please sign in to comment.