@@ -110,7 +110,7 @@ Returns:
110
110
111
111
A handle to the new task
112
112
*/
113
- fn spawn ( - f : sendfn ( ) ) -> task {
113
+ fn spawn ( + f : sendfn ( ) ) -> task {
114
114
spawn_inner ( f, none)
115
115
}
116
116
@@ -139,7 +139,7 @@ A task that sends notification upon termination
139
139
*/
140
140
type joinable_task = ( task , comm:: port < task_notification > ) ;
141
141
142
- fn spawn_joinable ( - f : sendfn ( ) ) -> joinable_task {
142
+ fn spawn_joinable ( + f : sendfn ( ) ) -> joinable_task {
143
143
let notify_port = comm:: port ( ) ;
144
144
let notify_chan = comm:: chan ( notify_port) ;
145
145
let task = spawn_inner ( f, some ( notify_chan) ) ;
@@ -189,6 +189,29 @@ tag task_notification {
189
189
exit( task, task_result) ;
190
190
}
191
191
192
+ /*
193
+ type connected_fn<ToCh, FrCh> = sendfn(comm::chan<FrCh>, comm::port<ToCh>);
194
+ type connected_task<ToCh, FrCh> = {
195
+ port: comm::port<FrCh>,
196
+ chan: comm::chan<ToCh>,
197
+ task: task
198
+ };
199
+ fn spawn_connected<ToCh:send, FrCh:send>(f: connected_fn<ToCh, FrCh>)
200
+ -> connected_fn {
201
+ let from_child_port = comm::port<FrCh>();
202
+ let from_child_chan = comm::chan(from_child_port);
203
+ let get_to_child_port = comm::port<comm::chan<ToCh>>();
204
+ let get_to_child_chan = comm::chan(to_child_port);
205
+ let child_task = spawn(sendfn[move f]() {
206
+ let to_child_port = comm::port<ToCh>();
207
+ comm::send(get_to_child_chan, to_child_port);
208
+ f(from_child_chan, to_child_port);
209
+ });
210
+ let to_child_chan = comm::recv(get_out);
211
+ ret {port: from_child_port, chan: to_child_chan, task: child_task};
212
+ }
213
+ */
214
+
192
215
/* Section: Operations */
193
216
194
217
/*
0 commit comments