Skip to content

Commit

Permalink
Sync rust_chan's deref() method with rustc's code.
Browse files Browse the repository at this point in the history
If the channel is associated with a port then the destructor will assert.
Additionally, destruction of the object is not always appropriate. This brings
the deref() method into sync with the behavior of generated rust code which
only invokes destroy() once the reference count goes to 0.
  • Loading branch information
robarnold authored and Eric Holk committed Jul 1, 2011
1 parent 02a5949 commit 4e59b0b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/rt/rust_chan.cpp
Expand Up @@ -7,6 +7,7 @@
rust_chan::rust_chan(rust_task *task,
maybe_proxy<rust_port> *port,
size_t unit_sz) :
ref_count(1),
task(task),
port(port),
buffer(task, unit_sz) {
Expand Down
4 changes: 2 additions & 2 deletions src/rt/rust_chan.h
@@ -1,10 +1,10 @@
#ifndef RUST_CHAN_H
#define RUST_CHAN_H

class rust_chan : public rc_base<rust_chan>,
public task_owned<rust_chan>,
class rust_chan : public task_owned<rust_chan>,
public rust_cond {
public:
RUST_REFCOUNTED_WITH_DTOR(rust_chan, destroy())
rust_chan(rust_task *task, maybe_proxy<rust_port> *port, size_t unit_sz);

~rust_chan();
Expand Down

0 comments on commit 4e59b0b

Please sign in to comment.