Skip to content

Commit 6123267

Browse files
author
Eric Holk
committed
---
yaml --- r: 4306 b: refs/heads/master c: b3d9d9b h: refs/heads/master v: v3
1 parent 082fc39 commit 6123267

File tree

4 files changed

+16
-14
lines changed

4 files changed

+16
-14
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 5a673cc2c9d1a85efb967c47e40cb805ba691b90
2+
refs/heads/master: b3d9d9b73cb9cae6b76e0a040756784112ed88a9

trunk/src/lib/comm.rs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ export _chan;
44
export _port;
55

66
export mk_port;
7-
export mk_chan;
87

98
native "rust" mod rustrt {
109
type rust_chan;
@@ -26,23 +25,27 @@ resource chan_ptr(ch: *rustrt::rust_chan) {
2625
rustrt::del_chan(ch);
2726
}
2827

29-
tag _chan[T] { _chan(@chan_dtor); }
30-
3128
resource port_ptr(po: *rustrt::rust_port) {
3229
rustrt::drop_port(po);
3330
rustrt::del_port(po);
3431
}
3532

36-
tag _port[T] { _port(@port_dtor); }
33+
obj _chan[T](raw_chan : @chan_ptr) {
34+
fn send(v : &T) {
3735

38-
fn mk_port[T]() -> _port[T] {
39-
_port(@port_dtor(rustrt::new_port(sys::size_of[T]())))
36+
}
4037
}
4138

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)))
4742
}
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]())))
4851
}

trunk/src/rt/rust_builtin.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,6 @@ void drop_chan(rust_task *task, rust_chan *chan) {
912912
extern "C" CDECL
913913
void drop_port(rust_task *, rust_port *port) {
914914
port->ref_count--;
915-
>>>>>>> Started working on a library-based comm system. Creating and deleting ports work.
916915
}
917916

918917
//

trunk/src/test/stdtest/comm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ import std::comm;
44
#[test]
55
fn create_port_and_chan() {
66
let p = comm::mk_port[int]();
7-
let c = comm::mk_chan(p);
7+
let c = p.mk_chan();
88
}

0 commit comments

Comments
 (0)