Skip to content

Commit

Permalink
More forwarding
Browse files Browse the repository at this point in the history
  • Loading branch information
endurodave committed Dec 13, 2024
1 parent 14e0bdb commit c5047a2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
18 changes: 9 additions & 9 deletions src/Delegate/DelegateAsync.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class DelegateAsyncMsg : public DelegateMsg
/// @param[in] invoker - the invoker instance
/// @param[in] args - a parameter pack of all target function arguments
DelegateAsyncMsg(std::shared_ptr<IDelegateInvoker> invoker, Args... args) : DelegateMsg(invoker),
m_args(make_tuple_heap(m_heapMem, m_start, args...))
m_args(make_tuple_heap(m_heapMem, m_start, std::forward<Args>(args)...))
{
}

Expand Down Expand Up @@ -185,7 +185,7 @@ class DelegateFreeAsync<RetType(Args...)> : public DelegateFree<RetType(Args...)
auto delegate = std::shared_ptr<ClassType>(Clone());

// Create a new message instance for sending to the destination thread
auto msg = std::make_shared<DelegateAsyncMsg<Args...>>(delegate, args...);
auto msg = std::make_shared<DelegateAsyncMsg<Args...>>(delegate, std::forward<Args>(args)...);

// Dispatch message onto the callback destination thread. DelegateInvoke()
// will be called by the destintation thread.
Expand All @@ -210,7 +210,7 @@ class DelegateFreeAsync<RetType(Args...)> : public DelegateFree<RetType(Args...)
/// @param[in] args The function arguments, if any.
/// @return None. Function invoked asynchronously without waiting for completion.
void AsyncInvoke(Args... args) {
operator()(args...);
operator()(std::forward<Args>(args)...);
}

/// @brief Invoke the delegate function on the destination thread. Called by the
Expand Down Expand Up @@ -402,7 +402,7 @@ class DelegateMemberAsync<TClass, RetType(Args...)> : public DelegateMember<TCla
auto delegate = std::shared_ptr<ClassType>(Clone());

// Create a new message instance for sending to the destination thread
auto msg = std::make_shared<DelegateAsyncMsg<Args...>>(delegate, args...);
auto msg = std::make_shared<DelegateAsyncMsg<Args...>>(delegate, std::forward<Args>(args)...);

// Dispatch message onto the callback destination thread. DelegateInvoke()
// will be called by the destintation thread.
Expand All @@ -427,7 +427,7 @@ class DelegateMemberAsync<TClass, RetType(Args...)> : public DelegateMember<TCla
/// @param[in] args The function arguments, if any.
/// @return None. Function invoked asynchronously without waiting for completion.
void AsyncInvoke(Args... args) {
operator()(args...);
operator()(std::forward<Args>(args)...);
}

/// @brief Invoke the delegate function on the destination thread. Called by the
Expand Down Expand Up @@ -620,7 +620,7 @@ class DelegateMemberSpAsync<TClass, RetType(Args...)> : public DelegateMemberSp<
auto delegate = std::shared_ptr<ClassType>(Clone());

// Create a new message instance for sending to the destination thread
auto msg = std::make_shared<DelegateAsyncMsg<Args...>>(delegate, args...);
auto msg = std::make_shared<DelegateAsyncMsg<Args...>>(delegate, std::forward<Args>(args)...);

// Dispatch message onto the callback destination thread. DelegateInvoke()
// will be called by the destintation thread.
Expand All @@ -645,7 +645,7 @@ class DelegateMemberSpAsync<TClass, RetType(Args...)> : public DelegateMemberSp<
/// @param[in] args The function arguments, if any.
/// @return None. Function invoked asynchronously without waiting for completion.
void AsyncInvoke(Args... args) {
operator()(args...);
operator()(std::forward<Args>(args)...);
}

/// @brief Invoke the delegate function on the destination thread. Called by the
Expand Down Expand Up @@ -821,7 +821,7 @@ class DelegateFunctionAsync<RetType(Args...)> : public DelegateFunction<RetType(
auto delegate = std::shared_ptr<ClassType>(Clone());

// Create a new message instance for sending to the destination thread
auto msg = std::make_shared<DelegateAsyncMsg<Args...>>(delegate, args...);
auto msg = std::make_shared<DelegateAsyncMsg<Args...>>(delegate, std::forward<Args>(args)...);

// Dispatch message onto the callback destination thread. DelegateInvoke()
// will be called by the destintation thread.
Expand All @@ -846,7 +846,7 @@ class DelegateFunctionAsync<RetType(Args...)> : public DelegateFunction<RetType(
/// @param[in] args The function arguments, if any.
/// @return None. Function invoked asynchronously without waiting for completion.
void AsyncInvoke(Args... args) {
operator()(args...);
operator()(std::forward<Args>(args)...);
}

/// @brief Invoke the delegate function on the destination thread. Called by the
Expand Down
10 changes: 5 additions & 5 deletions src/Delegate/DelegateAsyncWait.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class DelegateAsyncWaitMsg : public DelegateMsg
/// @param[in] invoker - the invoker instance
/// @param[in] args - a parameter pack of all target function arguments
DelegateAsyncWaitMsg(std::shared_ptr<IDelegateInvoker> invoker, Args... args) : DelegateMsg(invoker),
m_args(args...)
m_args(std::forward<Args>(args)...)
{
}

Expand Down Expand Up @@ -243,7 +243,7 @@ class DelegateFreeAsyncWait<RetType(Args...)> : public DelegateFreeAsync<RetType
auto delegate = std::shared_ptr<ClassType>(Clone());

// Create a new message instance for sending to the destination thread.
auto msg = std::make_shared<DelegateAsyncWaitMsg<Args...>>(delegate, args...);
auto msg = std::make_shared<DelegateAsyncWaitMsg<Args...>>(delegate, std::forward<Args>(args)...);
msg->SetInvokerWaiting(true);

// Dispatch message onto the callback destination thread. DelegateInvoke()
Expand Down Expand Up @@ -489,7 +489,7 @@ class DelegateMemberAsyncWait<TClass, RetType(Args...)> : public DelegateMemberA
auto delegate = std::shared_ptr<ClassType>(Clone());

// Create a new message instance for sending to the destination thread.
auto msg = std::make_shared<DelegateAsyncWaitMsg<Args...>>(delegate, args...);
auto msg = std::make_shared<DelegateAsyncWaitMsg<Args...>>(delegate, std::forward<Args>(args)...);
msg->SetInvokerWaiting(true);

// Dispatch message onto the callback destination thread. DelegateInvoke()
Expand Down Expand Up @@ -735,7 +735,7 @@ class DelegateMemberSpAsyncWait<TClass, RetType(Args...)> : public DelegateMembe
auto delegate = std::shared_ptr<ClassType>(Clone());

// Create a new message instance for sending to the destination thread.
auto msg = std::make_shared<DelegateAsyncWaitMsg<Args...>>(delegate, args...);
auto msg = std::make_shared<DelegateAsyncWaitMsg<Args...>>(delegate, std::forward<Args>(args)...);
msg->SetInvokerWaiting(true);

// Dispatch message onto the callback destination thread. DelegateInvoke()
Expand Down Expand Up @@ -972,7 +972,7 @@ class DelegateFunctionAsyncWait<RetType(Args...)> : public DelegateFunctionAsync
auto delegate = std::shared_ptr<ClassType>(Clone());

// Create a new message instance for sending to the destination thread.
auto msg = std::make_shared<DelegateAsyncWaitMsg<Args...>>(delegate, args...);
auto msg = std::make_shared<DelegateAsyncWaitMsg<Args...>>(delegate, std::forward<Args>(args)...);
msg->SetInvokerWaiting(true);

// Dispatch message onto the callback destination thread. DelegateInvoke()
Expand Down

0 comments on commit c5047a2

Please sign in to comment.