Skip to content

Commit 962997a

Browse files
committed
---
yaml --- r: 32703 b: refs/heads/dist-snap c: 4f5bff9 h: refs/heads/master i: 32701: 4c103a0 32699: 9b84e63 32695: 2fc7116 32687: c60e233 32671: 08349aa 32639: 1370474 v: v3
1 parent fdbc6bc commit 962997a

File tree

7 files changed

+790
-784
lines changed

7 files changed

+790
-784
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
99
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
10-
refs/heads/dist-snap: 591c152dfc07bc43b132f6ec0f24f2d5e8e06620
10+
refs/heads/dist-snap: 4f5bff993b44c412bb57afe2d6c3709f5371e3d4
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/dist-snap/src/libcore/core.rc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,8 @@ mod comm;
222222
mod task {
223223
mod local_data;
224224
mod local_data_priv;
225+
mod spawn;
226+
mod rt;
225227
}
226228
mod future;
227229
mod pipes;

branches/dist-snap/src/libcore/task.rs

Lines changed: 29 additions & 776 deletions
Large diffs are not rendered by default.

branches/dist-snap/src/libcore/task/local_data.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ type LocalDataKey<T: Owned> = &fn(+@T);
5252
unsafe fn local_data_pop<T: Owned>(
5353
key: LocalDataKey<T>) -> Option<@T> {
5454

55-
local_pop(rustrt::rust_get_task(), key)
55+
local_pop(rt::rust_get_task(), key)
5656
}
5757
/**
5858
* Retrieve a task-local data value. It will also be kept alive in the
@@ -61,7 +61,7 @@ unsafe fn local_data_pop<T: Owned>(
6161
unsafe fn local_data_get<T: Owned>(
6262
key: LocalDataKey<T>) -> Option<@T> {
6363

64-
local_get(rustrt::rust_get_task(), key)
64+
local_get(rt::rust_get_task(), key)
6565
}
6666
/**
6767
* Store a value in task-local data. If this key already has a value,
@@ -70,7 +70,7 @@ unsafe fn local_data_get<T: Owned>(
7070
unsafe fn local_data_set<T: Owned>(
7171
key: LocalDataKey<T>, +data: @T) {
7272

73-
local_set(rustrt::rust_get_task(), key, data)
73+
local_set(rt::rust_get_task(), key, data)
7474
}
7575
/**
7676
* Modify a task-local data value. If the function returns 'None', the
@@ -80,7 +80,7 @@ unsafe fn local_data_modify<T: Owned>(
8080
key: LocalDataKey<T>,
8181
modify_fn: fn(Option<@T>) -> Option<@T>) {
8282

83-
local_modify(rustrt::rust_get_task(), key, modify_fn)
83+
local_modify(rt::rust_get_task(), key, modify_fn)
8484
}
8585

8686
#[test]

branches/dist-snap/src/libcore/task/local_data_priv.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#[doc(hidden)]; // FIXME #3538
22

33
use local_data::LocalDataKey;
4+
use rt::rust_task;
45

56
trait LocalData { }
67
impl<T: Owned> @T: LocalData { }
@@ -34,13 +35,13 @@ unsafe fn get_task_local_map(task: *rust_task) -> TaskLocalMap {
3435
// NOTE: The map's box lives in TLS invisibly referenced once. Each time
3536
// we retrieve it for get/set, we make another reference, which get/set
3637
// drop when they finish. No "re-storing after modifying" is needed.
37-
let map_ptr = rustrt::rust_get_task_local_data(task);
38+
let map_ptr = rt::rust_get_task_local_data(task);
3839
if map_ptr.is_null() {
3940
let map: TaskLocalMap = @dvec::DVec();
4041
// Use reinterpret_cast -- transmute would take map away from us also.
41-
rustrt::rust_set_task_local_data(
42+
rt::rust_set_task_local_data(
4243
task, cast::reinterpret_cast(&map));
43-
rustrt::rust_task_local_data_atexit(task, cleanup_task_local_map);
44+
rt::rust_task_local_data_atexit(task, cleanup_task_local_map);
4445
// Also need to reference it an extra time to keep it for now.
4546
cast::bump_box_refcount(map);
4647
map
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*!
2+
3+
The task interface to the runtime
4+
5+
*/
6+
7+
#[doc(hidden)]; // FIXME #3538
8+
9+
#[allow(non_camel_case_types)] // runtime type
10+
type sched_id = int;
11+
#[allow(non_camel_case_types)] // runtime type
12+
type task_id = int;
13+
14+
// These are both opaque runtime/compiler types that we don't know the
15+
// structure of and should only deal with via unsafe pointer
16+
#[allow(non_camel_case_types)] // runtime type
17+
type rust_task = libc::c_void;
18+
#[allow(non_camel_case_types)] // runtime type
19+
type rust_closure = libc::c_void;
20+
21+
extern {
22+
#[rust_stack]
23+
fn rust_task_yield(task: *rust_task) -> bool;
24+
25+
fn rust_get_sched_id() -> sched_id;
26+
fn rust_new_sched(num_threads: libc::uintptr_t) -> sched_id;
27+
fn rust_sched_threads() -> libc::size_t;
28+
fn rust_sched_current_nonlazy_threads() -> libc::size_t;
29+
fn rust_num_threads() -> libc::uintptr_t;
30+
31+
fn get_task_id() -> task_id;
32+
#[rust_stack]
33+
fn rust_get_task() -> *rust_task;
34+
35+
fn new_task() -> *rust_task;
36+
fn rust_new_task_in_sched(id: sched_id) -> *rust_task;
37+
38+
fn start_task(task: *rust_task, closure: *rust_closure);
39+
40+
fn rust_task_is_unwinding(task: *rust_task) -> bool;
41+
fn rust_osmain_sched_id() -> sched_id;
42+
#[rust_stack]
43+
fn rust_task_inhibit_kill(t: *rust_task);
44+
#[rust_stack]
45+
fn rust_task_allow_kill(t: *rust_task);
46+
#[rust_stack]
47+
fn rust_task_inhibit_yield(t: *rust_task);
48+
#[rust_stack]
49+
fn rust_task_allow_yield(t: *rust_task);
50+
fn rust_task_kill_other(task: *rust_task);
51+
fn rust_task_kill_all(task: *rust_task);
52+
53+
#[rust_stack]
54+
fn rust_get_task_local_data(task: *rust_task) -> *libc::c_void;
55+
#[rust_stack]
56+
fn rust_set_task_local_data(task: *rust_task, map: *libc::c_void);
57+
#[rust_stack]
58+
fn rust_task_local_data_atexit(task: *rust_task, cleanup_fn: *u8);
59+
}

0 commit comments

Comments
 (0)