Change uv::Async to accept data parameters

This is a breaking change as it makes Async a template (e.g. Async<> must
be used instead of just Async).  When data parameters are provided, an
internal mutex and vector is used to hold the parameter packs until the loop
runs.
This commit is contained in:
Peter Johnson
2018-08-06 11:08:17 -07:00
parent 4a3e43d4a7
commit 1de1900dbb
3 changed files with 156 additions and 5 deletions

View File

@@ -12,7 +12,7 @@
namespace wpi {
namespace uv {
std::shared_ptr<Async> Async::Create(Loop& loop) {
std::shared_ptr<Async<>> Async<>::Create(Loop& loop) {
auto h = std::make_shared<Async>(private_init{});
int err = uv_async_init(loop.GetRaw(), h->GetRaw(), [](uv_async_t* handle) {
Async& h = *static_cast<Async*>(handle->data);