LCOV - code coverage report
Current view: top level - muse/framework/global/concurrency - concurrent.h Coverage Total Hit
Test: filtered_coverage.info Lines: 100.0 % 3 3
Test Date: 2026-11-05 04:07:02

            Line data    Source code
       1              : /*
       2              :  * SPDX-License-Identifier: GPL-3.0-only
       3              :  * MuseScore-CLA-applies
       4              :  *
       5              :  * MuseScore Studio
       6              :  * Music Composition & Notation
       7              :  *
       8              :  * Copyright (C) 2022 MuseScore Limited and others
       9              :  *
      10              :  * This program is free software: you can redistribute it and/or modify
      11              :  * it under the terms of the GNU General Public License version 3 as
      12              :  * published by the Free Software Foundation.
      13              :  *
      14              :  * This program is distributed in the hope that it will be useful,
      15              :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      16              :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      17              :  * GNU General Public License for more details.
      18              :  *
      19              :  * You should have received a copy of the GNU General Public License
      20              :  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
      21              :  */
      22              : 
      23              : #pragma once
      24              : 
      25              : #include "muse_framework_config.h"
      26              : 
      27              : #ifdef MUSE_THREADS_SUPPORT
      28              : 
      29              : #include <QtConcurrent>
      30              : 
      31              : #include "log.h"
      32              : 
      33              : namespace muse {
      34              : class Concurrent
      35              : {
      36              : public:
      37              : 
      38              :     template<typename Functor>
      39           30 :     static void run(Functor functor)
      40              :     {
      41           30 :         UNUSED(QtConcurrent::run(functor));
      42           30 :     }
      43              : 
      44              :     // not const object, not const fn
      45              :     template<typename Class>
      46              :     static void run(Class* object, void (Class::* fn)())
      47              :     {
      48              :         UNUSED(QtConcurrent::run(fn, object));
      49              :     }
      50              : 
      51              :     template<typename Class, typename Param1, typename Arg1>
      52              :     static void run(Class* object, void (Class::* fn)(Param1), const Arg1& arg1)
      53              :     {
      54              :         UNUSED(QtConcurrent::run(object, fn, arg1));
      55              :     }
      56              : 
      57              :     template<typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2>
      58              :     static void run(Class* object, void (Class::* fn)(Param1, Param2), const Arg1& arg1, const Arg2& arg2)
      59              :     {
      60              :         UNUSED(QtConcurrent::run(fn, object, arg1, arg2));
      61              :     }
      62              : 
      63              :     // not const object, const fn
      64              :     template<typename Class>
      65              :     static void run(Class* object, void (Class::* fn)() const)
      66              :     {
      67              :         UNUSED(QtConcurrent::run(fn, object));
      68              :     }
      69              : 
      70              :     template<typename Class, typename Param1, typename Arg1>
      71              :     static void run(Class* object, void (Class::* fn)(Param1) const, const Arg1& arg1)
      72              :     {
      73              :         UNUSED(QtConcurrent::run(object, fn, arg1));
      74              :     }
      75              : 
      76              :     template<typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2>
      77              :     static void run(Class* object, void (Class::* fn)(Param1, Param2) const, const Arg1& arg1, const Arg2& arg2)
      78              :     {
      79              :         UNUSED(QtConcurrent::run(fn, object, arg1, arg2));
      80              :     }
      81              : };
      82              : }
      83              : 
      84              : #endif // MUSE_THREADS_SUPPORT
        

Generated by: LCOV version 2.0-1