Commit 4356a5d4 authored by Dominik Charousset's avatar Dominik Charousset

Check whether mapping exists before calling it

parent 2babe0a0
...@@ -38,7 +38,6 @@ namespace opencl { ...@@ -38,7 +38,6 @@ namespace opencl {
template <typename T, typename R> template <typename T, typename R>
class command : public ref_counted { class command : public ref_counted {
public: public:
command(response_promise handle, intrusive_ptr<T> actor_facade, command(response_promise handle, intrusive_ptr<T> actor_facade,
std::vector<cl_event> events, std::vector<mem_ptr> arguments, std::vector<cl_event> events, std::vector<mem_ptr> arguments,
...@@ -49,8 +48,10 @@ class command : public ref_counted { ...@@ -49,8 +48,10 @@ class command : public ref_counted {
m_queue(actor_facade->m_queue), m_queue(actor_facade->m_queue),
m_events(std::move(events)), m_events(std::move(events)),
m_arguments(std::move(arguments)), m_arguments(std::move(arguments)),
m_result(m_result_size), m_result(result_size),
m_msg(msg) {} m_msg(msg) {
// nop
}
~command() { ~command() {
for (auto& e : m_events) { for (auto& e : m_events) {
...@@ -125,7 +126,9 @@ class command : public ref_counted { ...@@ -125,7 +126,9 @@ class command : public ref_counted {
message m_msg; // required to keep the argument buffers alive (async copy) message m_msg; // required to keep the argument buffers alive (async copy)
void handle_results() { void handle_results() {
m_handle.deliver(m_actor_facade->m_map_result(m_result)); auto& map_fun = m_actor_facade->m_map_result;
auto msg = map_fun ? map_fun(m_result) : make_message(std::move(m_result));
m_handle.deliver(std::move(msg));
} }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment