diff --git a/host-apis/wasi-0.2.0-rc-2023-10-18/host_api.cpp b/host-apis/wasi-0.2.0-rc-2023-10-18/host_api.cpp index 732525f..4c35cb1 100644 --- a/host-apis/wasi-0.2.0-rc-2023-10-18/host_api.cpp +++ b/host-apis/wasi-0.2.0-rc-2023-10-18/host_api.cpp @@ -95,10 +95,10 @@ template <> struct HandleOps { } // namespace -size_t api::AsyncTask::select(std::vector *tasks) { - auto count = tasks->size(); +size_t api::AsyncTask::select(std::vector &tasks) { + auto count = tasks.size(); vector> handles; - for (const auto task : *tasks) { + for (const auto task : tasks) { handles.emplace_back(task->id()); } auto list = list_borrow_pollable_t{ diff --git a/host-apis/wasi-0.2.0-rc-2023-12-05/host_api.cpp b/host-apis/wasi-0.2.0-rc-2023-12-05/host_api.cpp index 263794e..126ce52 100644 --- a/host-apis/wasi-0.2.0-rc-2023-12-05/host_api.cpp +++ b/host-apis/wasi-0.2.0-rc-2023-12-05/host_api.cpp @@ -99,10 +99,10 @@ template <> struct HandleOps { } // namespace -size_t api::AsyncTask::select(std::vector *tasks) { - auto count = tasks->size(); +size_t api::AsyncTask::select(std::vector &tasks) { + auto count = tasks.size(); vector> handles; - for (const auto task : *tasks) { + for (const auto task : tasks) { handles.emplace_back(task->id()); } auto list = list_borrow_pollable_t{ diff --git a/host-apis/wasi-0.2.0/host_api.cpp b/host-apis/wasi-0.2.0/host_api.cpp index 32e73ed..aa77453 100644 --- a/host-apis/wasi-0.2.0/host_api.cpp +++ b/host-apis/wasi-0.2.0/host_api.cpp @@ -247,10 +247,10 @@ class OutgoingBodyHandle final : public WASIHandle { } }; -size_t api::AsyncTask::select(std::vector *tasks) { +size_t api::AsyncTask::select(std::vector &tasks) { auto count = tasks->size(); vector::Borrowed> handles; - for (const auto task : *tasks) { + for (const auto task : tasks) { handles.emplace_back(task->id()); } auto list = list_borrow_pollable_t{ handles.data(), count}; diff --git a/include/extension-api.h b/include/extension-api.h index 0b4e7b6..4f5360f 100644 --- a/include/extension-api.h +++ b/include/extension-api.h @@ -147,7 +147,7 @@ class AsyncTask { /** * Select for the next available ready task, providing the oldest ready first. */ - static size_t select(std::vector *handles); + static size_t select(std::vector &handles); }; } // namespace api diff --git a/runtime/event_loop.cpp b/runtime/event_loop.cpp index ee8637e..a66438d 100644 --- a/runtime/event_loop.cpp +++ b/runtime/event_loop.cpp @@ -84,7 +84,7 @@ bool EventLoop::run_event_loop(api::Engine *engine, double total_compute) { } // Select the next task to run according to event-loop semantics of oldest-first. - size_t task_idx = api::AsyncTask::select(tasks); + size_t task_idx = api::AsyncTask::select(*tasks); auto task = tasks->at(task_idx); bool success = task->run(engine);