Browse Source

Allow moving into AsyncCallInvoker

tags/2021-05-28
reuk Tom Poole 6 years ago
parent
commit
4a294eaa39
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      modules/juce_events/messages/juce_MessageManager.h

+ 4
- 4
modules/juce_events/messages/juce_MessageManager.h View File

@@ -96,9 +96,9 @@ public:
//==============================================================================
/** Asynchronously invokes a function or C++11 lambda on the message thread. */
template <typename FunctionType>
static void callAsync (FunctionType functionToCall)
static void callAsync (FunctionType&& functionToCall)
{
new AsyncCallInvoker<FunctionType> (functionToCall);
new AsyncCallInvoker<FunctionType> (std::forward<FunctionType> (functionToCall));
}
/** Calls a function using the message-thread.
@@ -343,8 +343,8 @@ private:
template <typename FunctionType>
struct AsyncCallInvoker : public MessageBase
{
AsyncCallInvoker (FunctionType f) : callback (f) { post(); }
void messageCallback() override { callback(); }
AsyncCallInvoker (FunctionType&& f) : callback (std::forward<FunctionType> (f)) { post(); }
void messageCallback() override { callback(); }
FunctionType callback;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AsyncCallInvoker)


Loading…
Cancel
Save