mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Allow moving into AsyncCallInvoker
This commit is contained in:
parent
e14a183886
commit
4a294eaa39
1 changed files with 4 additions and 4 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue