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:
QMetaObject::invokeMethod(worker,
"queryCustomCommand", Q_ARG
( qint64 , trans
) ,Q_ARG
( QString, sql
));
QMetaObject::invokeMethod(worker, "queryCustomCommand", Q_ARG( qint64 , trans ) ,Q_ARG( QString, sql ));
To copy to clipboard, switch view to plain text mode
or :
QMetaObject::invokeMethod(worker,
"getTagLastChangeTime", Q_ARG
( pQueryValueRequest_t ,req
) ,Q_ARG
( qint64, trans
));
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:
struct StackItem{
char* methodName;
QList<QGenericArgument> argList;
};
struct StackItem{
char* methodName;
QList<QGenericArgument> argList;
};
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
Bookmarks