In addition to the qthread class, multiple threads are used in QT, And the qtconcurrent framework and qrunable class are also used. (Java is also used in QT ).
Both qtconcurrent and qrunable are used together with the Global thread pool.
Qtconcurrent and qrunable are only applicable to multiple projects, and they are highly independent.
Qtconcurrent: Run () function is relatively simple. Put the item you want to process into a function and pass it to the run () function.
Use this method
The first is the function pointer. below is the parameter.
In Java, multithreading has a runable interface, and the class can implement this interface, while C ++ does not have an interface. Therefore, to use qrunable, you must inherit it and rewrite it.Run function.
Qrunable is generally used with the global thread pool.
Qthreadpool: globalinstance ()-> Start (qrunable subclass); // is it similar to Java?