File tree Expand file tree Collapse file tree 3 files changed +15
-13
lines changed Expand file tree Collapse file tree 3 files changed +15
-13
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,6 @@ export _chan;
4
4
export _port;
5
5
6
6
export mk_port;
7
- export mk_chan;
8
7
9
8
native "rust" mod rustrt {
10
9
type rust_chan ;
@@ -26,23 +25,27 @@ resource chan_ptr(ch: *rustrt::rust_chan) {
26
25
rustrt:: del_chan ( ch) ;
27
26
}
28
27
29
- tag _chan[ T ] { _chan ( @chan_dtor) ; }
30
-
31
28
resource port_ptr( po: * rustrt:: rust_port) {
32
29
rustrt:: drop_port ( po) ;
33
30
rustrt:: del_port ( po) ;
34
31
}
35
32
36
- tag _port[ T ] { _port ( @port_dtor) ; }
33
+ obj _chan[ T ] ( raw_chan : @chan_ptr) {
34
+ fn send ( v : & T ) {
37
35
38
- fn mk_port[ T ] ( ) -> _port[ T ] {
39
- _port ( @port_dtor ( rustrt:: new_port ( sys:: size_of[ T ] ( ) ) ) )
36
+ }
40
37
}
41
38
42
- fn mk_chan[ T ] ( po : & _port[ T ] ) -> _chan[ T ] {
43
- alt po {
44
- _port( _po) {
45
- _chan ( @chan_dtor ( rustrt:: new_chan ( * * _po) ) )
46
- }
39
+ obj _port[ T ] ( raw_port : @port_ptr) {
40
+ fn mk_chan ( ) -> _chan[ T ] {
41
+ _chan ( @chan_ptr ( rustrt:: new_chan ( * * raw_port) ) )
47
42
}
43
+
44
+ fn recv_into ( v : & T ) {
45
+
46
+ }
47
+ }
48
+
49
+ fn mk_port[ T ] ( ) -> _port[ T ] {
50
+ _port ( @port_ptr ( rustrt:: new_port ( sys:: size_of[ T ] ( ) ) ) )
48
51
}
Original file line number Diff line number Diff line change @@ -912,7 +912,6 @@ void drop_chan(rust_task *task, rust_chan *chan) {
912
912
extern " C" CDECL
913
913
void drop_port (rust_task *, rust_port *port) {
914
914
port->ref_count --;
915
- >>>>>>> Started working on a library-based comm system. Creating and deleting ports work.
916
915
}
917
916
918
917
//
Original file line number Diff line number Diff line change @@ -4,5 +4,5 @@ import std::comm;
4
4
#[ test]
5
5
fn create_port_and_chan ( ) {
6
6
let p = comm:: mk_port[ int] ( ) ;
7
- let c = comm :: mk_chan ( p ) ;
7
+ let c = p . mk_chan ( ) ;
8
8
}
You can’t perform that action at this time.
0 commit comments