2010-06-23 21:03:09 -07:00
|
|
|
#ifndef RUST_CHAN_H
|
|
|
|
#define RUST_CHAN_H
|
|
|
|
|
2011-07-07 11:53:08 -07:00
|
|
|
class rust_chan : public kernel_owned<rust_chan>,
|
2010-07-28 16:46:13 -07:00
|
|
|
public rust_cond {
|
2010-06-23 21:03:09 -07:00
|
|
|
public:
|
2011-06-30 19:27:35 -07:00
|
|
|
RUST_REFCOUNTED_WITH_DTOR(rust_chan, destroy())
|
2011-07-19 14:31:55 -07:00
|
|
|
rust_chan(rust_kernel *kernel, maybe_proxy<rust_port> *port,
|
|
|
|
size_t unit_sz);
|
2010-09-07 18:39:07 -07:00
|
|
|
|
2010-06-23 21:03:09 -07:00
|
|
|
~rust_chan();
|
|
|
|
|
2011-07-07 11:53:08 -07:00
|
|
|
rust_kernel *kernel;
|
2011-07-19 14:31:55 -07:00
|
|
|
rust_task *task;
|
2010-07-28 16:46:13 -07:00
|
|
|
maybe_proxy<rust_port> *port;
|
|
|
|
size_t idx;
|
2010-07-19 14:05:18 -07:00
|
|
|
circular_buffer buffer;
|
2010-06-23 21:03:09 -07:00
|
|
|
|
2010-07-28 16:46:13 -07:00
|
|
|
void associate(maybe_proxy<rust_port> *port);
|
2010-06-23 21:03:09 -07:00
|
|
|
void disassociate();
|
2010-07-28 16:46:13 -07:00
|
|
|
bool is_associated();
|
2010-07-19 14:05:18 -07:00
|
|
|
|
2010-08-09 08:15:34 -07:00
|
|
|
void send(void *sptr);
|
2011-06-29 20:54:03 -07:00
|
|
|
|
|
|
|
rust_chan *clone(maybe_proxy<rust_task> *target);
|
2011-06-30 08:29:35 -07:00
|
|
|
|
|
|
|
// Called whenever the channel's ref count drops to zero.
|
|
|
|
void destroy();
|
2010-06-23 21:03:09 -07:00
|
|
|
};
|
|
|
|
|
2010-07-28 00:36:35 -07:00
|
|
|
//
|
|
|
|
// Local Variables:
|
|
|
|
// mode: C++
|
|
|
|
// fill-column: 78;
|
|
|
|
// indent-tabs-mode: nil
|
|
|
|
// c-basic-offset: 4
|
|
|
|
// buffer-file-coding-system: utf-8-unix
|
2011-07-13 13:51:20 -07:00
|
|
|
// compile-command: "make -k -C $RBUILD 2>&1 | sed -e 's/\\/x\\//x:\\//g'";
|
2010-07-28 00:36:35 -07:00
|
|
|
// End:
|
|
|
|
//
|
|
|
|
|
2010-06-23 21:03:09 -07:00
|
|
|
#endif /* RUST_CHAN_H */
|