Skip to content

Commit b787a26

Browse files
committed
De-export comm, task. Part of #3583.
1 parent 201513e commit b787a26

File tree

3 files changed

+23
-70
lines changed

3 files changed

+23
-70
lines changed

src/libcore/comm.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,6 @@ type port_id = int;
274274

275275
#[abi = "cdecl"]
276276
extern mod rustrt {
277-
#[legacy_exports];
278277
fn rust_port_id_send(target_port: port_id, data: *()) -> libc::uintptr_t;
279278

280279
fn new_port(unit_sz: libc::size_t) -> *rust_port;
@@ -297,7 +296,6 @@ extern mod rustrt {
297296

298297
#[abi = "rust-intrinsic"]
299298
extern mod rusti {
300-
#[legacy_exports];
301299
fn init<T>() -> T;
302300
}
303301

src/libcore/core.rc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@ mod dlist_iter {
216216
mod send_map;
217217

218218
// Concurrency
219-
#[legacy_exports]
220219
mod comm;
221220
#[legacy_exports]
222221
mod task {

src/libcore/task.rs

Lines changed: 23 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -32,54 +32,11 @@ use result::Result;
3232
use pipes::{stream, Chan, Port};
3333
use local_data_priv::{local_get, local_set};
3434

35-
export Task;
36-
export TaskResult;
37-
export Notification;
38-
export SchedMode;
39-
export SchedOpts;
40-
export TaskOpts;
41-
export TaskBuilder;
42-
43-
export task;
44-
export default_task_opts;
45-
export get_opts;
46-
export set_opts;
47-
export set_sched_mode;
48-
export add_wrapper;
49-
export run;
50-
51-
export future_result;
52-
export run_listener;
53-
export run_with;
54-
55-
export spawn;
56-
export spawn_unlinked;
57-
export spawn_supervised;
58-
export spawn_with;
59-
export spawn_listener;
60-
export spawn_conversation;
61-
export spawn_sched;
62-
export try;
63-
64-
export yield;
65-
export failing;
66-
export get_task;
67-
export unkillable, rekillable;
68-
export atomically;
69-
70-
export local_data;
71-
72-
export SingleThreaded;
73-
export ThreadPerCore;
74-
export ThreadPerTask;
75-
export ManualThreads;
76-
export PlatformThread;
77-
7835
use rt::task_id;
7936
use rt::rust_task;
8037

8138
/// A handle to a task
82-
enum Task {
39+
pub enum Task {
8340
TaskHandle(task_id)
8441
}
8542

@@ -99,7 +56,7 @@ impl Task : cmp::Eq {
9956
* If you wish for this result's delivery to block until all linked and/or
10057
* children tasks complete, recommend using a result future.
10158
*/
102-
enum TaskResult {
59+
pub enum TaskResult {
10360
Success,
10461
Failure,
10562
}
@@ -115,7 +72,7 @@ impl TaskResult : Eq {
11572
}
11673

11774
/// A message type for notifying of task lifecycle events
118-
enum Notification {
75+
pub enum Notification {
11976
/// Sent when a task exits with the task handle and result
12077
Exit(Task, TaskResult)
12178
}
@@ -134,7 +91,7 @@ impl Notification : cmp::Eq {
13491
}
13592

13693
/// Scheduler modes
137-
enum SchedMode {
94+
pub enum SchedMode {
13895
/// All tasks run in the same OS thread
13996
SingleThreaded,
14097
/// Tasks are distributed among available CPUs
@@ -207,7 +164,7 @@ impl SchedMode : cmp::Eq {
207164
* default these foreign stacks have unspecified size, but with this
208165
* option their size can be precisely specified.
209166
*/
210-
type SchedOpts = {
167+
pub type SchedOpts = {
211168
mode: SchedMode,
212169
foreign_stack_size: Option<uint>
213170
};
@@ -239,7 +196,7 @@ type SchedOpts = {
239196
* into foreign code that blocks. Without doing so in a different
240197
* scheduler other tasks will be impeded or even blocked indefinitely.
241198
*/
242-
type TaskOpts = {
199+
pub type TaskOpts = {
243200
linked: bool,
244201
supervised: bool,
245202
mut notify_chan: Option<Chan<Notification>>,
@@ -260,7 +217,7 @@ type TaskOpts = {
260217
// the run function move them in.
261218

262219
// FIXME (#2585): Replace the 'consumed' bit with move mode on self
263-
enum TaskBuilder = {
220+
pub enum TaskBuilder = {
264221
opts: TaskOpts,
265222
gen_body: fn@(+v: fn~()) -> fn~(),
266223
can_not_copy: Option<util::NonCopyable>,
@@ -272,7 +229,7 @@ enum TaskBuilder = {
272229
* configuration methods can be chained.
273230
* For example, task().unlinked().spawn is equivalent to spawn_unlinked.
274231
*/
275-
fn task() -> TaskBuilder {
232+
pub fn task() -> TaskBuilder {
276233
TaskBuilder({
277234
opts: default_task_opts(),
278235
gen_body: |body| move body, // Identity function
@@ -580,7 +537,7 @@ impl TaskBuilder {
580537
581538
/* Task construction */
582539
583-
fn default_task_opts() -> TaskOpts {
540+
pub fn default_task_opts() -> TaskOpts {
584541
/*!
585542
* The default task options
586543
*
@@ -598,7 +555,7 @@ fn default_task_opts() -> TaskOpts {
598555
599556
/* Spawn convenience functions */
600557
601-
fn spawn(+f: fn~()) {
558+
pub fn spawn(+f: fn~()) {
602559
/*!
603560
* Creates and executes a new child task
604561
*
@@ -611,7 +568,7 @@ fn spawn(+f: fn~()) {
611568
task().spawn(move f)
612569
}
613570
614-
fn spawn_unlinked(+f: fn~()) {
571+
pub fn spawn_unlinked(+f: fn~()) {
615572
/*!
616573
* Creates a child task unlinked from the current one. If either this
617574
* task or the child task fails, the other will not be killed.
@@ -620,7 +577,7 @@ fn spawn_unlinked(+f: fn~()) {
620577
task().unlinked().spawn(move f)
621578
}
622579
623-
fn spawn_supervised(+f: fn~()) {
580+
pub fn spawn_supervised(+f: fn~()) {
624581
/*!
625582
* Creates a child task unlinked from the current one. If either this
626583
* task or the child task fails, the other will not be killed.
@@ -629,7 +586,7 @@ fn spawn_supervised(+f: fn~()) {
629586
task().supervised().spawn(move f)
630587
}
631588
632-
fn spawn_with<A:Send>(+arg: A, +f: fn~(+v: A)) {
589+
pub fn spawn_with<A:Send>(+arg: A, +f: fn~(+v: A)) {
633590
/*!
634591
* Runs a task, while transfering ownership of one argument to the
635592
* child.
@@ -643,7 +600,7 @@ fn spawn_with<A:Send>(+arg: A, +f: fn~(+v: A)) {
643600
task().spawn_with(move arg, move f)
644601
}
645602
646-
fn spawn_listener<A:Send>(+f: fn~(comm::Port<A>)) -> comm::Chan<A> {
603+
pub fn spawn_listener<A:Send>(+f: fn~(comm::Port<A>)) -> comm::Chan<A> {
647604
/*!
648605
* Runs a new task while providing a channel from the parent to the child
649606
*
@@ -653,7 +610,7 @@ fn spawn_listener<A:Send>(+f: fn~(comm::Port<A>)) -> comm::Chan<A> {
653610
task().spawn_listener(move f)
654611
}
655612
656-
fn spawn_conversation<A: Send, B: Send>
613+
pub fn spawn_conversation<A: Send, B: Send>
657614
(+f: fn~(comm::Port<A>, comm::Chan<B>))
658615
-> (comm::Port<B>, comm::Chan<A>) {
659616
/*!
@@ -665,7 +622,7 @@ fn spawn_conversation<A: Send, B: Send>
665622
task().spawn_conversation(move f)
666623
}
667624
668-
fn spawn_sched(mode: SchedMode, +f: fn~()) {
625+
pub fn spawn_sched(mode: SchedMode, +f: fn~()) {
669626
/*!
670627
* Creates a new scheduler and executes a task on it
671628
*
@@ -682,7 +639,7 @@ fn spawn_sched(mode: SchedMode, +f: fn~()) {
682639
task().sched_mode(mode).spawn(move f)
683640
}
684641
685-
fn try<T:Send>(+f: fn~() -> T) -> Result<T,()> {
642+
pub fn try<T:Send>(+f: fn~() -> T) -> Result<T,()> {
686643
/*!
687644
* Execute a function in another task and return either the return value
688645
* of the function or result::err.
@@ -696,7 +653,7 @@ fn try<T:Send>(+f: fn~() -> T) -> Result<T,()> {
696653
697654
/* Lifecycle functions */
698655
699-
fn yield() {
656+
pub fn yield() {
700657
//! Yield control to the task scheduler
701658
702659
let task_ = rt::rust_get_task();
@@ -706,13 +663,13 @@ fn yield() {
706663
}
707664
}
708665

709-
fn failing() -> bool {
666+
pub fn failing() -> bool {
710667
//! True if the running task has failed
711668
712669
rt::rust_task_is_unwinding(rt::rust_get_task())
713670
}
714671

715-
fn get_task() -> Task {
672+
pub fn get_task() -> Task {
716673
//! Get a handle to the running task
717674
718675
TaskHandle(rt::get_task_id())
@@ -733,7 +690,7 @@ fn get_task() -> Task {
733690
* }
734691
* ~~~
735692
*/
736-
unsafe fn unkillable<U>(f: fn() -> U) -> U {
693+
pub unsafe fn unkillable<U>(f: fn() -> U) -> U {
737694
struct AllowFailure {
738695
t: *rust_task,
739696
drop { rt::rust_task_allow_kill(self.t); }
@@ -752,7 +709,7 @@ unsafe fn unkillable<U>(f: fn() -> U) -> U {
752709
}
753710

754711
/// The inverse of unkillable. Only ever to be used nested in unkillable().
755-
unsafe fn rekillable<U>(f: fn() -> U) -> U {
712+
pub unsafe fn rekillable<U>(f: fn() -> U) -> U {
756713
struct DisallowFailure {
757714
t: *rust_task,
758715
drop { rt::rust_task_inhibit_kill(self.t); }
@@ -774,7 +731,7 @@ unsafe fn rekillable<U>(f: fn() -> U) -> U {
774731
* A stronger version of unkillable that also inhibits scheduling operations.
775732
* For use with exclusive ARCs, which use pthread mutexes directly.
776733
*/
777-
unsafe fn atomically<U>(f: fn() -> U) -> U {
734+
pub unsafe fn atomically<U>(f: fn() -> U) -> U {
778735
struct DeferInterrupts {
779736
t: *rust_task,
780737
drop {
@@ -1102,7 +1059,6 @@ fn test_spawn_sched_childs_on_same_sched() {
11021059
#[nolink]
11031060
#[cfg(test)]
11041061
extern mod testrt {
1105-
#[legacy_exports];
11061062
fn rust_dbg_lock_create() -> *libc::c_void;
11071063
fn rust_dbg_lock_destroy(lock: *libc::c_void);
11081064
fn rust_dbg_lock_lock(lock: *libc::c_void);

0 commit comments

Comments
 (0)