I have a read and write function in a class file. this class subclasses QThread
class and overrides run, does not have signals and slots ,It basically runs data processing functions in a threa开发者_如何学编程d. in its constructor is the method movetothread(this)
. To have the two functions to form a queue and implement muli-threading ,
can i make a movetothread(secondthread)
call in the write function?
void write(args)
{
movetothread(secondthread);
}
to make the write function run on a separate thread. How and when does the write function stop?.
It doesn't work that way. QObject::moveToThread
associates the object with another thread, not the calling function. Furthermore, this affects future event processing only.
精彩评论