diff options
| author | Eric Holk <eholk@mozilla.com> | 2011-07-27 14:51:25 -0700 |
|---|---|---|
| committer | Eric Holk <eholk@mozilla.com> | 2011-07-28 10:47:28 -0700 |
| commit | 279844ce9fc64969d1c048335214627ab50237a0 (patch) | |
| tree | 40156df61bc5df2bb3c1f1839f4afd65052db7e7 /src/rt/rust_chan.cpp | |
| parent | a5fe66e7065c0e91064f3a818ea901ecfb499b70 (diff) | |
| download | rust-279844ce9fc64969d1c048335214627ab50237a0.tar.gz rust-279844ce9fc64969d1c048335214627ab50237a0.zip | |
Atomic reference counting for tasks.
Diffstat (limited to 'src/rt/rust_chan.cpp')
| -rw-r--r-- | src/rt/rust_chan.cpp | 18 |
1 files changed, 3 insertions, 15 deletions
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<rust_task> *target) { +rust_chan *rust_chan::clone(rust_task *target) { size_t unit_sz = buffer.unit_sz; maybe_proxy<rust_port> *port = this->port; - rust_task *target_task = NULL; - if (target->is_proxy() == false) { - port = this->port; - target_task = target->referent(); - } else { - rust_handle<rust_port> *handle = - task->sched->kernel->get_port_handle(port->as_referent()); - maybe_proxy<rust_port> *proxy = new rust_proxy<rust_port> (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); } |
