diff options
| author | Brian Anderson <banderson@mozilla.com> | 2011-11-30 23:26:23 -0800 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2011-12-01 10:24:21 -0800 |
| commit | 7476a39e47d4c5d8e1a349adf590ee329501a0a8 (patch) | |
| tree | ddd0b84f6db54324978580971153296cdc34c68e /src/rt/rust_uv.cpp | |
| parent | b2fd6121c081bbb244256f9c98c338d6efd85326 (diff) | |
| download | rust-7476a39e47d4c5d8e1a349adf590ee329501a0a8.tar.gz rust-7476a39e47d4c5d8e1a349adf590ee329501a0a8.zip | |
stdlib: Implement some preliminary libuv bindings
std::uv is intended to be low-level, exactly mirroring the C API. Difficult to continue the implementation now without scheduler improvements.
Diffstat (limited to 'src/rt/rust_uv.cpp')
| -rw-r--r-- | src/rt/rust_uv.cpp | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/rt/rust_uv.cpp b/src/rt/rust_uv.cpp new file mode 100644 index 00000000000..b339d77c043 --- /dev/null +++ b/src/rt/rust_uv.cpp @@ -0,0 +1,50 @@ +#include "rust_internal.h" +#include "uv.h" + +/* + Wrappers of uv_* functions. These can be eliminated by figuring + out how to build static uv with externs, or by just using dynamic libuv + */ + +extern "C" CDECL uv_loop_t* +rust_uv_default_loop() { + return uv_default_loop(); +} + +extern "C" CDECL uv_loop_t* +rust_uv_loop_new() { + return uv_loop_new(); +} + +extern "C" CDECL void +rust_uv_loop_delete(uv_loop_t *loop) { + return uv_loop_delete(loop); +} + +extern "C" CDECL int +rust_uv_run(uv_loop_t *loop) { + return uv_run(loop); +} + +extern "C" CDECL void +rust_uv_unref(uv_loop_t *loop) { + return uv_unref(loop); +} + +extern "C" CDECL int +rust_uv_idle_init(uv_loop_t* loop, uv_idle_t* idle) { + return uv_idle_init(loop, idle); +} + +extern "C" CDECL int +rust_uv_idle_start(uv_idle_t* idle, uv_idle_cb cb) { + return uv_idle_start(idle, cb); +} + + + + +extern "C" CDECL size_t +rust_uv_size_of_idle_t() { + return sizeof(uv_idle_t); +} |
