@@ -48,7 +48,7 @@ export listen;
48
48
* transmitted. If a port value is copied, both copies refer to the same
49
49
* port. Ports may be associated with multiple `chan`s.
50
50
*/
51
- enum Port < T : send > {
51
+ enum Port < T : Send > {
52
52
Port_ ( @PortPtr < T > )
53
53
}
54
54
@@ -64,16 +64,16 @@ enum Port<T: send> {
64
64
* data will be silently dropped. Channels may be duplicated and
65
65
* themselves transmitted over other channels.
66
66
*/
67
- enum Chan < T : send > {
67
+ enum Chan < T : Send > {
68
68
Chan_ ( port_id )
69
69
}
70
70
71
71
/// Constructs a port
72
- fn Port < T : send > ( ) -> Port < T > {
72
+ fn Port < T : Send > ( ) -> Port < T > {
73
73
Port_ ( @PortPtr ( rustrt:: new_port ( sys:: size_of :: < T > ( ) as size_t ) ) )
74
74
}
75
75
76
- impl < T : send > Port < T > {
76
+ impl < T : Send > Port < T > {
77
77
78
78
fn chan ( ) -> Chan < T > { Chan ( self ) }
79
79
fn send ( +v : T ) { self . chan ( ) . send ( v) }
@@ -82,7 +82,7 @@ impl<T: send> Port<T> {
82
82
83
83
}
84
84
85
- impl < T : send > Chan < T > {
85
+ impl < T : Send > Chan < T > {
86
86
87
87
fn chan ( ) -> Chan < T > { self }
88
88
fn send ( +v : T ) { send ( self , v) }
@@ -92,12 +92,12 @@ impl<T: send> Chan<T> {
92
92
}
93
93
94
94
/// Open a new receiving channel for the duration of a function
95
- fn listen < T : send , U > ( f : fn ( Chan < T > ) -> U ) -> U {
95
+ fn listen < T : Send , U > ( f : fn ( Chan < T > ) -> U ) -> U {
96
96
let po = Port ( ) ;
97
97
f ( po. chan ( ) )
98
98
}
99
99
100
- struct PortPtr < T : send > {
100
+ struct PortPtr < T : Send > {
101
101
po : * rust_port ,
102
102
drop unsafe {
103
103
do task:: unkillable {
@@ -121,7 +121,7 @@ struct PortPtr<T:send> {
121
121
}
122
122
}
123
123
124
- fn PortPtr < T : send > ( po : * rust_port ) -> PortPtr < T > {
124
+ fn PortPtr < T : Send > ( po : * rust_port ) -> PortPtr < T > {
125
125
PortPtr {
126
126
po : po
127
127
}
@@ -135,7 +135,7 @@ fn PortPtr<T: send>(po: *rust_port) -> PortPtr<T> {
135
135
* Fails if the port is detached or dead. Fails if the port
136
136
* is owned by a different task.
137
137
*/
138
- fn as_raw_port < T : send , U > ( ch : comm:: Chan < T > , f : fn ( * rust_port ) -> U ) -> U {
138
+ fn as_raw_port < T : Send , U > ( ch : comm:: Chan < T > , f : fn ( * rust_port ) -> U ) -> U {
139
139
140
140
struct PortRef {
141
141
p : * rust_port ,
@@ -167,15 +167,15 @@ fn as_raw_port<T: send, U>(ch: comm::Chan<T>, f: fn(*rust_port) -> U) -> U {
167
167
* Constructs a channel. The channel is bound to the port used to
168
168
* construct it.
169
169
*/
170
- fn Chan < T : send > ( p : Port < T > ) -> Chan < T > {
170
+ fn Chan < T : Send > ( p : Port < T > ) -> Chan < T > {
171
171
Chan_ ( rustrt:: get_port_id ( ( * * p) . po ) )
172
172
}
173
173
174
174
/**
175
175
* Sends data over a channel. The sent data is moved into the channel,
176
176
* whereupon the caller loses access to it.
177
177
*/
178
- fn send< T : send > ( ch : Chan < T > , +data : T ) {
178
+ fn send< T : Send > ( ch : Chan < T > , +data : T ) {
179
179
let Chan_ ( p) = ch;
180
180
let data_ptr = ptr:: addr_of ( data) as * ( ) ;
181
181
let res = rustrt:: rust_port_id_send ( p, data_ptr) ;
@@ -190,22 +190,22 @@ fn send<T: send>(ch: Chan<T>, +data: T) {
190
190
* Receive from a port. If no data is available on the port then the
191
191
* task will block until data becomes available.
192
192
*/
193
- fn recv < T : send > ( p : Port < T > ) -> T { recv_ ( ( * * p) . po ) }
193
+ fn recv < T : Send > ( p : Port < T > ) -> T { recv_ ( ( * * p) . po ) }
194
194
195
195
/// Returns true if there are messages available
196
- fn peek < T : send > ( p : Port < T > ) -> bool { peek_ ( ( * * p) . po ) }
196
+ fn peek < T : Send > ( p : Port < T > ) -> bool { peek_ ( ( * * p) . po ) }
197
197
198
198
#[ doc( hidden) ]
199
- fn recv_chan < T : send > ( ch : comm:: Chan < T > ) -> T {
199
+ fn recv_chan < T : Send > ( ch : comm:: Chan < T > ) -> T {
200
200
as_raw_port ( ch, |x|recv_ ( x) )
201
201
}
202
202
203
- fn peek_chan < T : send > ( ch : comm:: Chan < T > ) -> bool {
203
+ fn peek_chan < T : Send > ( ch : comm:: Chan < T > ) -> bool {
204
204
as_raw_port ( ch, |x|peek_ ( x) )
205
205
}
206
206
207
207
/// Receive on a raw port pointer
208
- fn recv_ < T : send > ( p : * rust_port ) -> T {
208
+ fn recv_ < T : Send > ( p : * rust_port ) -> T {
209
209
let yield = 0 u;
210
210
let yieldp = ptr:: addr_of ( yield ) ;
211
211
let mut res;
@@ -231,7 +231,7 @@ fn peek_(p: *rust_port) -> bool {
231
231
}
232
232
233
233
/// Receive on one of two ports
234
- fn select2 < A : send , B : send > ( p_a : Port < A > , p_b : Port < B > )
234
+ fn select2 < A : Send , B : Send > ( p_a : Port < A > , p_b : Port < B > )
235
235
-> Either < A , B > {
236
236
let ports = ~[ ( * * p_a) . po , ( * * p_b) . po ] ;
237
237
let yield = 0 u, yieldp = ptr:: addr_of ( yield ) ;
0 commit comments