@@ -69,38 +69,38 @@ macro_rules! move_it (
69
69
{ $x: expr } => { unsafe { let y <- * ptr:: addr_of( & ( $x) ) ; move y } }
70
70
)
71
71
72
- type TaskSet = send_map:: linear:: LinearMap < * rust_task , ( ) > ;
72
+ pub type TaskSet = send_map:: linear:: LinearMap < * rust_task , ( ) > ;
73
73
74
- fn new_taskset ( ) -> TaskSet {
74
+ pub fn new_taskset ( ) -> TaskSet {
75
75
send_map:: linear:: LinearMap ( )
76
76
}
77
- fn taskset_insert ( tasks : & mut TaskSet , task : * rust_task ) {
77
+ pub fn taskset_insert ( tasks : & mut TaskSet , task : * rust_task ) {
78
78
let didnt_overwrite = tasks. insert ( task, ( ) ) ;
79
79
assert didnt_overwrite;
80
80
}
81
- fn taskset_remove ( tasks : & mut TaskSet , task : * rust_task ) {
81
+ pub fn taskset_remove ( tasks : & mut TaskSet , task : * rust_task ) {
82
82
let was_present = tasks. remove ( & task) ;
83
83
assert was_present;
84
84
}
85
- fn taskset_each ( tasks : & TaskSet , blk : fn ( v : * rust_task ) -> bool ) {
85
+ pub fn taskset_each ( tasks : & TaskSet , blk : fn ( v : * rust_task ) -> bool ) {
86
86
tasks. each_key ( |k| blk ( * k) )
87
87
}
88
88
89
89
// One of these per group of linked-failure tasks.
90
- type TaskGroupData = {
90
+ pub type TaskGroupData = {
91
91
// All tasks which might kill this group. When this is empty, the group
92
92
// can be "GC"ed (i.e., its link in the ancestor list can be removed).
93
93
mut members : TaskSet ,
94
94
// All tasks unidirectionally supervised by (directly or transitively)
95
95
// tasks in this group.
96
96
mut descendants : TaskSet ,
97
97
} ;
98
- type TaskGroupArc = private:: Exclusive < Option < TaskGroupData > > ;
98
+ pub type TaskGroupArc = private:: Exclusive < Option < TaskGroupData > > ;
99
99
100
- type TaskGroupInner = & mut Option < TaskGroupData > ;
100
+ pub type TaskGroupInner = & mut Option < TaskGroupData > ;
101
101
102
102
// A taskgroup is 'dead' when nothing can cause it to fail; only members can.
103
- pure fn taskgroup_is_dead ( tg : & TaskGroupData ) -> bool {
103
+ pub pure fn taskgroup_is_dead ( tg : & TaskGroupData ) -> bool {
104
104
( & tg. members ) . is_empty ( )
105
105
}
106
106
@@ -111,7 +111,7 @@ pure fn taskgroup_is_dead(tg: &TaskGroupData) -> bool {
111
111
// taskgroup which was spawned-unlinked. Tasks from intermediate generations
112
112
// have references to the middle of the list; when intermediate generations
113
113
// die, their node in the list will be collected at a descendant's spawn-time.
114
- type AncestorNode = {
114
+ pub type AncestorNode = {
115
115
// Since the ancestor list is recursive, we end up with references to
116
116
// exclusives within other exclusives. This is dangerous business (if
117
117
// circular references arise, deadlock and memory leaks are imminent).
@@ -124,16 +124,16 @@ type AncestorNode = {
124
124
// Recursive rest of the list.
125
125
mut ancestors : AncestorList ,
126
126
} ;
127
- enum AncestorList = Option < private : : Exclusive < AncestorNode > > ;
127
+ pub enum AncestorList = Option < private : : Exclusive < AncestorNode > > ;
128
128
129
129
// Accessors for taskgroup arcs and ancestor arcs that wrap the unsafety.
130
130
#[ inline( always) ]
131
- fn access_group < U > ( x : & TaskGroupArc , blk : fn ( TaskGroupInner ) -> U ) -> U {
131
+ pub fn access_group < U > ( x : & TaskGroupArc , blk : fn ( TaskGroupInner ) -> U ) -> U {
132
132
unsafe { x. with ( blk) }
133
133
}
134
134
135
135
#[ inline( always) ]
136
- fn access_ancestors < U > ( x : & private:: Exclusive < AncestorNode > ,
136
+ pub fn access_ancestors < U > ( x : & private:: Exclusive < AncestorNode > ,
137
137
blk : fn ( x : & mut AncestorNode ) -> U ) -> U {
138
138
unsafe { x. with ( blk) }
139
139
}
@@ -146,9 +146,9 @@ fn access_ancestors<U>(x: &private::Exclusive<AncestorNode>,
146
146
// (3) As a bonus, coalesces away all 'dead' taskgroup nodes in the list.
147
147
// FIXME(#2190): Change Option<fn@(...)> to Option<fn&(...)>, to save on
148
148
// allocations. Once that bug is fixed, changing the sigil should suffice.
149
- fn each_ancestor ( list : & mut AncestorList ,
150
- bail_opt : Option < fn @( TaskGroupInner ) > ,
151
- forward_blk : fn ( TaskGroupInner ) -> bool )
149
+ pub fn each_ancestor ( list : & mut AncestorList ,
150
+ bail_opt : Option < fn @( TaskGroupInner ) > ,
151
+ forward_blk : fn ( TaskGroupInner ) -> bool )
152
152
-> bool {
153
153
// "Kickoff" call - there was no last generation.
154
154
return !coalesce ( list, bail_opt, forward_blk, uint:: max_value) ;
@@ -271,7 +271,7 @@ fn each_ancestor(list: &mut AncestorList,
271
271
}
272
272
273
273
// One of these per task.
274
- struct TCB {
274
+ pub struct TCB {
275
275
me : * rust_task ,
276
276
// List of tasks with whose fates this one's is intertwined.
277
277
tasks : TaskGroupArc , // 'none' means the group has failed.
@@ -303,7 +303,7 @@ struct TCB {
303
303
}
304
304
}
305
305
306
- fn TCB ( me : * rust_task , tasks : TaskGroupArc , ancestors : AncestorList ,
306
+ pub fn TCB ( me : * rust_task , tasks : TaskGroupArc , ancestors : AncestorList ,
307
307
is_main : bool , notifier : Option < AutoNotify > ) -> TCB {
308
308
309
309
let notifier = move notifier;
@@ -318,7 +318,7 @@ fn TCB(me: *rust_task, tasks: TaskGroupArc, ancestors: AncestorList,
318
318
}
319
319
}
320
320
321
- struct AutoNotify {
321
+ pub struct AutoNotify {
322
322
notify_chan : Chan < Notification > ,
323
323
mut failed : bool ,
324
324
drop {
@@ -327,15 +327,15 @@ struct AutoNotify {
327
327
}
328
328
}
329
329
330
- fn AutoNotify ( chan : Chan < Notification > ) -> AutoNotify {
330
+ pub fn AutoNotify ( chan : Chan < Notification > ) -> AutoNotify {
331
331
AutoNotify {
332
332
notify_chan : chan,
333
333
failed : true // Un-set above when taskgroup successfully made.
334
334
}
335
335
}
336
336
337
- fn enlist_in_taskgroup ( state : TaskGroupInner , me : * rust_task ,
338
- is_member : bool ) -> bool {
337
+ pub fn enlist_in_taskgroup ( state : TaskGroupInner , me : * rust_task ,
338
+ is_member : bool ) -> bool {
339
339
let newstate = util:: replace ( state, None ) ;
340
340
// If 'None', the group was failing. Can't enlist.
341
341
if newstate. is_some ( ) {
@@ -350,7 +350,8 @@ fn enlist_in_taskgroup(state: TaskGroupInner, me: *rust_task,
350
350
}
351
351
352
352
// NB: Runs in destructor/post-exit context. Can't 'fail'.
353
- fn leave_taskgroup ( state : TaskGroupInner , me : * rust_task , is_member : bool ) {
353
+ pub fn leave_taskgroup ( state : TaskGroupInner , me : * rust_task ,
354
+ is_member : bool ) {
354
355
let newstate = util:: replace ( state, None ) ;
355
356
// If 'None', already failing and we've already gotten a kill signal.
356
357
if newstate. is_some ( ) {
@@ -362,7 +363,7 @@ fn leave_taskgroup(state: TaskGroupInner, me: *rust_task, is_member: bool) {
362
363
}
363
364
364
365
// NB: Runs in destructor/post-exit context. Can't 'fail'.
365
- fn kill_taskgroup ( state : TaskGroupInner , me : * rust_task , is_main : bool ) {
366
+ pub fn kill_taskgroup ( state : TaskGroupInner , me : * rust_task , is_main : bool ) {
366
367
// NB: We could do the killing iteration outside of the group arc, by
367
368
// having "let mut newstate" here, swapping inside, and iterating after.
368
369
// But that would let other exiting tasks fall-through and exit while we
@@ -404,8 +405,8 @@ macro_rules! taskgroup_key (
404
405
( ) => ( cast:: transmute( ( -2 as uint, 0 u) ) )
405
406
)
406
407
407
- fn gen_child_taskgroup ( linked : bool , supervised : bool )
408
- -> ( TaskGroupArc , AncestorList , bool ) {
408
+ pub fn gen_child_taskgroup ( linked : bool , supervised : bool )
409
+ -> ( TaskGroupArc , AncestorList , bool ) {
409
410
let spawner = rt:: rust_get_task ( ) ;
410
411
/*######################################################################*
411
412
* Step 1. Get spawner's taskgroup info.
@@ -486,7 +487,7 @@ fn gen_child_taskgroup(linked: bool, supervised: bool)
486
487
}
487
488
}
488
489
489
- fn spawn_raw ( opts : TaskOpts , +f : fn ~( ) ) {
490
+ pub fn spawn_raw ( opts : TaskOpts , +f : fn ~( ) ) {
490
491
let ( child_tg, ancestors, is_main) =
491
492
gen_child_taskgroup ( opts. linked , opts. supervised ) ;
492
493
0 commit comments