MythTV  master
Classes | Functions
MConcurrent Namespace Reference

Provides a simple version of QtConcurrent::run() that uses MThreadPool rather than QThreadPool. More...

Classes

class  RunFunctionTask
 
class  VoidStoredMemberFunctionPointerCall0
 
class  VoidStoredMemberFunctionPointerCall1
 
class  VoidStoredMemberFunctionPointerCall2
 
class  VoidStoredMemberFunctionPointerCall3
 
class  VoidStoredMemberFunctionPointerCall4
 
class  VoidStoredMemberFunctionPointerCall5
 

Functions

template<typename Class >
void run (const QString &name, Class *object, void(Class::*fn)())
 
template<typename Class , typename Param1 , typename Arg1 >
void run (const QString &name, Class *object, void(Class::*fn)(Param1), const Arg1 &arg1)
 
template<typename Class , typename Param1 , typename Arg1 , typename Param2 , typename Arg2 >
void run (const QString &name, Class *object, void(Class::*fn)(Param1, Param2), const Arg1 &arg1, const Arg2 &arg2)
 
template<typename Class , typename Param1 , typename Arg1 , typename Param2 , typename Arg2 , typename Param3 , typename Arg3 >
void run (const QString &name, Class *object, void(Class::*fn)(Param1, Param2, Param3), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3)
 
template<typename Class , typename Param1 , typename Arg1 , typename Param2 , typename Arg2 , typename Param3 , typename Arg3 , typename Param4 , typename Arg4 >
void run (const QString &name, Class *object, void(Class::*fn)(Param1, Param2, Param3, Param4), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4)
 
template<typename Class , typename Param1 , typename Arg1 , typename Param2 , typename Arg2 , typename Param3 , typename Arg3 , typename Param4 , typename Arg4 , typename Param5 , typename Arg5 >
void run (const QString &name, Class *object, void(Class::*fn)(Param1, Param2, Param3, Param4, Param5), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg4 &arg5)
 

Detailed Description

Provides a simple version of QtConcurrent::run() that uses MThreadPool rather than QThreadPool.

Useful for starting background threads in 1 line.

Given a class method of:

void Class::fn(arg1, arg2...)

you can run it in a different thread using:

MConcurrent::run("thread name", &Class instance, &Class::fn, arg1, arg2...)

Refer to QtConcurrent::run for further details

Restrictions:

  1. Accepts 0-5 arguments
  2. Only class methods are supported (most typical in Myth)
  3. Only non-const classes & methods are supported (most typical in Myth)
  4. The method must have return type of void (QFuture is not easily ported to MThreadPool. Use signals/events instead)

Function Documentation

◆ run() [1/6]

template<typename Class >
void MConcurrent::run ( const QString &  name,
Class *  object,
void(Class::*)()  fn 
)

◆ run() [2/6]

template<typename Class , typename Param1 , typename Arg1 >
void MConcurrent::run ( const QString &  name,
Class *  object,
void(Class::*)(Param1)  fn,
const Arg1 &  arg1 
)

Definition at line 143 of file mconcurrent.h.

◆ run() [3/6]

template<typename Class , typename Param1 , typename Arg1 , typename Param2 , typename Arg2 >
void MConcurrent::run ( const QString &  name,
Class *  object,
void(Class::*)(Param1, Param2)  fn,
const Arg1 &  arg1,
const Arg2 &  arg2 
)

Definition at line 149 of file mconcurrent.h.

◆ run() [4/6]

template<typename Class , typename Param1 , typename Arg1 , typename Param2 , typename Arg2 , typename Param3 , typename Arg3 >
void MConcurrent::run ( const QString &  name,
Class *  object,
void(Class::*)(Param1, Param2, Param3)  fn,
const Arg1 &  arg1,
const Arg2 &  arg2,
const Arg3 &  arg3 
)

Definition at line 155 of file mconcurrent.h.

◆ run() [5/6]

template<typename Class , typename Param1 , typename Arg1 , typename Param2 , typename Arg2 , typename Param3 , typename Arg3 , typename Param4 , typename Arg4 >
void MConcurrent::run ( const QString &  name,
Class *  object,
void(Class::*)(Param1, Param2, Param3, Param4)  fn,
const Arg1 &  arg1,
const Arg2 &  arg2,
const Arg3 &  arg3,
const Arg4 &  arg4 
)

Definition at line 161 of file mconcurrent.h.

◆ run() [6/6]

template<typename Class , typename Param1 , typename Arg1 , typename Param2 , typename Arg2 , typename Param3 , typename Arg3 , typename Param4 , typename Arg4 , typename Param5 , typename Arg5 >
void MConcurrent::run ( const QString &  name,
Class *  object,
void(Class::*)(Param1, Param2, Param3, Param4, Param5)  fn,
const Arg1 &  arg1,
const Arg2 &  arg2,
const Arg3 &  arg3,
const Arg4 &  arg4,
const Arg4 &  arg5 
)

Definition at line 167 of file mconcurrent.h.