Commit Graph

4 Commits

Author SHA1 Message Date
Brad King
3bcaa87007 cmUVHandlePtr: Add uv_process_ptr 2017-11-30 13:43:43 -05:00
Brad King
dd700e9bfb cmUVHandlePtr: Add uv_timer_ptr 2017-11-30 13:26:35 -05:00
Brad King
32cfa7b324 cmUVHandlePtr: Move to CMakeLib to make it available everywhere 2017-11-30 11:19:31 -05:00
Justin Berger
a3abb85c6f Add RAII handles for libuv handle types
The `uv_*_t` handle types are closed by `uv_close`, but the semantics
are tricky.  Calling `uv_close` may not close immediately.  Instead it
hands ownership to the uv loop to which the handle is currently
attached.  When the loop decides to close it, a callback is used to
allow the `uv_close` caller to free resources.

Provide an abstraction layer as `cm::uv_*_ptr` types corresponding to
the `uv_*_t` handle types.  Each pointer is either empty (`nullptr`)
or has an initialized handle attached to a loop.  Use move semantics
to ensure a single owner of the handle so that clients can predict
when the handle is destroyed.
2017-11-29 16:36:31 -05:00