Hello,

I want to distribute requests from a system to a limited number of threads. I can run a request on the thread using signals/slots or QMetaObject::invokeMethod function. But I also want to buffer the incoming requests for running them later when a thread becomes available.

For example I have a function call like:

Qt Code:
  1. QMetaObject::invokeMethod(worker, "queryCustomCommand", Q_ARG( qint64 , trans ) ,Q_ARG( QString, sql ));
To copy to clipboard, switch view to plain text mode 
or :
Qt Code:
  1. QMetaObject::invokeMethod(worker, "getTagLastChangeTime", Q_ARG( pQueryValueRequest_t ,req ) ,Q_ARG( qint64, trans ));
To copy to clipboard, switch view to plain text mode 

These should be buffered in an appropriate way.
I tried to create a list of struct representing the method and arguments. But I couldnt find a way to represent the Q_ARG vars in the struct:

Qt Code:
  1. struct StackItem{
  2. char* methodName;
  3. QList<QGenericArgument> argList;
  4. };
To copy to clipboard, switch view to plain text mode 

Here I couldnt form the "argList" element.(Compile errors, etc...)
What is the right way of queuing these function calls?

Thanks in advance,
Yigit