From 279844ce9fc64969d1c048335214627ab50237a0 Mon Sep 17 00:00:00 2001 From: Eric Holk Date: Wed, 27 Jul 2011 14:51:25 -0700 Subject: Atomic reference counting for tasks. --- src/rt/rust_chan.cpp | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'src/rt/rust_chan.cpp') diff --git a/src/rt/rust_chan.cpp b/src/rt/rust_chan.cpp index 9253d7d0361..dc6ea0fefdf 100644 --- a/src/rt/rust_chan.cpp +++ b/src/rt/rust_chan.cpp @@ -60,7 +60,7 @@ void rust_chan::disassociate() { // "disassociating chan: 0x%" PRIxPTR " from port: 0x%" PRIxPTR, // this, port->referent()); --this->ref_count; - --this->task->ref_count; + task->deref(); this->task = NULL; port->referent()->chans.swap_delete(this); } @@ -109,22 +109,10 @@ void rust_chan::send(void *sptr) { return; } -rust_chan *rust_chan::clone(maybe_proxy *target) { +rust_chan *rust_chan::clone(rust_task *target) { size_t unit_sz = buffer.unit_sz; maybe_proxy *port = this->port; - rust_task *target_task = NULL; - if (target->is_proxy() == false) { - port = this->port; - target_task = target->referent(); - } else { - rust_handle *handle = - task->sched->kernel->get_port_handle(port->as_referent()); - maybe_proxy *proxy = new rust_proxy (handle); - DLOG(task->sched, mem, "new proxy: " PTR, proxy); - port = proxy; - target_task = target->as_proxy()->handle()->referent(); - } - return new (target_task->kernel, "cloned chan") + return new (target->kernel, "cloned chan") rust_chan(kernel, port, unit_sz); } -- cgit 1.4.1-3-g733a5