blob: 38f93a7da9feb307de8338b8293e13e882169a74 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#include "rust_internal.h"
#include "rust_chan.h"
rust_chan::rust_chan(rust_task *task, rust_port *port) :
task(task),
port(port),
buffer(task->dom, port->unit_sz),
token(this)
{
if (port)
port->chans.push(this);
}
rust_chan::~rust_chan()
{
if (port) {
if (token.pending())
token.withdraw();
port->chans.swapdel(this);
}
}
void
rust_chan::disassociate()
{
I(task->dom, port);
if (token.pending())
token.withdraw();
// Delete reference to the port/
port = NULL;
}
|