diff options
| author | Michael Bebenita <[email protected]> | 2010-07-19 14:05:18 -0700 |
|---|---|---|
| committer | Michael Bebenita <[email protected]> | 2010-07-19 14:05:18 -0700 |
| commit | 00d1465d13980fc3acf650f182ee0723fbda0e06 (patch) | |
| tree | a73cf5f0f20c0bee6722b33d975eb930919fefdf /src/rt/rust_proxy.h | |
| parent | Add a test for an obvious-seeming (but not actually legal) kind of cast attem... (diff) | |
| download | rust-00d1465d13980fc3acf650f182ee0723fbda0e06.tar.xz rust-00d1465d13980fc3acf650f182ee0723fbda0e06.zip | |
Added a message passing system based on lock free queues for inter-thread communication. Channels now buffer on the sending side, and no longer require blocking when sending. Lots of other refactoring and bug fixes.
Diffstat (limited to 'src/rt/rust_proxy.h')
| -rw-r--r-- | src/rt/rust_proxy.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/rt/rust_proxy.h b/src/rt/rust_proxy.h new file mode 100644 index 00000000..8059dd89 --- /dev/null +++ b/src/rt/rust_proxy.h @@ -0,0 +1,31 @@ +/** + * A proxy object is a wrapper around other Rust objects. One use of the proxy + * object is to mitigate access between tasks in different thread domains. + */ + +#ifndef RUST_PROXY_H +#define RUST_PROXY_H + +template <typename T> struct +rust_proxy_delegate : public rc_base<T> { +protected: + T *_delegate; +public: + rust_proxy_delegate(T * delegate) : _delegate(delegate) { + } + T *delegate() { return _delegate; } +}; + +template <typename T> struct +rust_proxy : public rust_proxy_delegate<T>, + public dom_owned<rust_proxy<T> > { +public: + rust_dom *dom; + rust_proxy(rust_dom *dom, T *delegate) : + rust_proxy_delegate<T> (delegate), + dom(dom) { + delegate->ref(); + } +}; + +#endif /* RUST_PROXY_H */ |