mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-09 20:29:10 +02:00
Use perfect forwarding in templates where possible
This commit is contained in:
@@ -138,8 +138,8 @@ class Vst3PlugViewProxyImpl : public Vst3PlugViewProxy {
|
||||
* @see Vst3HostBridge::send_mutually_recursive_message
|
||||
*/
|
||||
template <typename T, typename F>
|
||||
T run_gui_task(F f) {
|
||||
std::packaged_task<T()> do_call(std::move(f));
|
||||
T run_gui_task(F fn) {
|
||||
std::packaged_task<T()> do_call(std::move(fn));
|
||||
std::future<T> do_call_response = do_call.get_future();
|
||||
|
||||
// If `Vst3Bridge::send_mutually_recursive_message()` is currently being
|
||||
|
||||
@@ -210,13 +210,13 @@ class Vst3PluginBridge : PluginBridge<Vst3Sockets<std::jthread>> {
|
||||
* @see Vst3PlugViewProxyImpl::run_gui_task
|
||||
*/
|
||||
template <typename F>
|
||||
bool maybe_run_on_mutual_recursion_thread(F& cb) {
|
||||
bool maybe_run_on_mutual_recursion_thread(F& fn) {
|
||||
// We're handling an `F&` here because we cannot copy a
|
||||
// `packged_task()`, and we need to be able to move that actual task
|
||||
std::unique_lock mutual_recursion_lock(mutual_recursion_contexts_mutex);
|
||||
if (!mutual_recursion_contexts.empty()) {
|
||||
boost::asio::dispatch(*mutual_recursion_contexts.back(),
|
||||
std::move(cb));
|
||||
std::move(fn));
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user