Skip to content

Commit 4beb4dc

Browse files
committed
---
yaml --- r: 149770 b: refs/heads/try2 c: 9668ab5 h: refs/heads/master v: v3
1 parent d6c75b3 commit 4beb4dc

File tree

8 files changed

+50
-13
lines changed

8 files changed

+50
-13
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: e6acff828787b9b6c65ef66942f45e58b2f22ad6
8+
refs/heads/try2: 9668ab58f338b27d8f53357c7fd4ea3d3f06305e
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libnative/io/timer_helper.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
//! time.
2222
2323
use std::cast;
24+
use std::rt::bookkeeping;
2425
use std::rt;
2526
use std::unstable::mutex::{StaticNativeMutex, NATIVE_MUTEX_INIT};
2627

27-
use bookkeeping;
2828
use io::timer::{Req, Shutdown};
2929
use task;
3030

branches/try2/src/libnative/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@
5858
use std::os;
5959
use std::rt;
6060

61-
mod bookkeeping;
6261
pub mod io;
6362
pub mod task;
6463

@@ -105,6 +104,5 @@ pub fn start(argc: int, argv: **u8, main: proc()) -> int {
105104
/// number of arguments.
106105
pub fn run(main: proc()) -> int {
107106
main();
108-
bookkeeping::wait_for_other_tasks();
109107
os::get_exit_status()
110108
}

branches/try2/src/libnative/task.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@
1616
1717
use std::any::Any;
1818
use std::cast;
19+
use std::rt::bookkeeping;
1920
use std::rt::env;
2021
use std::rt::local::Local;
2122
use std::rt::rtio;
23+
use std::rt::stack;
2224
use std::rt::task::{Task, BlockedTask, SendMessage};
2325
use std::rt::thread::Thread;
2426
use std::rt;
2527
use std::task::TaskOpts;
2628
use std::unstable::mutex::NativeMutex;
27-
use std::rt::stack;
2829

2930
use io;
3031
use task;
31-
use bookkeeping;
3232

3333
/// Creates a new Task which is ready to execute as a 1:1 task.
3434
pub fn new(stack_bounds: (uint, uint)) -> ~Task {

branches/try2/src/libnative/bookkeeping.rs renamed to branches/try2/src/libstd/rt/bookkeeping.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,21 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//! 1:1 Task bookkeeping
11+
//! Task bookkeeping
1212
//!
13-
//! This module keeps track of the number of running 1:1 tasks so that entry
14-
//! points with libnative know when it's possible to exit the program (once all
15-
//! tasks have exited).
13+
//! This module keeps track of the number of running tasks so that entry points
14+
//! with libnative know when it's possible to exit the program (once all tasks
15+
//! have exited).
1616
//!
17-
//! The green counterpart for this is bookkeeping on sched pools.
17+
//! The green counterpart for this is bookkeeping on sched pools, and it's up to
18+
//! each respective runtime to make sure that they call increment() and
19+
//! decrement() manually.
1820
19-
use std::sync::atomics;
20-
use std::unstable::mutex::{StaticNativeMutex, NATIVE_MUTEX_INIT};
21+
#[experimental]; // this is a massive code smell
22+
#[doc(hidden)];
23+
24+
use sync::atomics;
25+
use unstable::mutex::{StaticNativeMutex, NATIVE_MUTEX_INIT};
2126

2227
static mut TASK_COUNT: atomics::AtomicUint = atomics::INIT_ATOMIC_UINT;
2328
static mut TASK_LOCK: StaticNativeMutex = NATIVE_MUTEX_INIT;

branches/try2/src/libstd/rt/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ pub mod args;
128128
// Support for running procedures when a program has exited.
129129
mod at_exit_imp;
130130

131+
// Bookkeeping for task counts
132+
pub mod bookkeeping;
133+
131134
// Stack overflow protection
132135
pub mod stack;
133136

@@ -207,6 +210,7 @@ pub fn at_exit(f: proc()) {
207210
/// Invoking cleanup while portions of the runtime are still in use may cause
208211
/// undefined behavior.
209212
pub unsafe fn cleanup() {
213+
bookkeeping::wait_for_other_tasks();
210214
at_exit_imp::run();
211215
args::cleanup();
212216
local_ptr::cleanup();
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// ignore-fast
12+
13+
extern crate native;
14+
extern crate green;
15+
extern crate rustuv;
16+
17+
#[start]
18+
fn start(argc: int, argv: **u8) -> int { green::start(argc, argv, main) }
19+
20+
fn main() {
21+
native::task::spawn(proc() customtask());
22+
}
23+
24+
fn customtask() {
25+
let mut timer = std::io::timer::Timer::new().unwrap();
26+
let periodic = timer.periodic(10);
27+
periodic.recv();
28+
}

branches/try2/src/test/run-pass/issue-12699.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// ignore-fast
12+
1113
extern crate native;
1214

1315
use std::io::timer;

0 commit comments

Comments
 (0)