kemere
18th May 2011, 07:53
I have a GUI which displays data traces using opengl. To make everything work nice, I've moved the code which updates the data to another thread. So I have something like this:
class DataObjectGL : QWidgetGL {
public:
DataUpdate : QObject
}
DataObjectGL :: DataObjectGL() {
dataUpdate = new DataUpdate();
dataUpdate->moveToThread(&GUIDataProcessThread);
}
I would like to generate an arbitrary (small) number of these objects depending on the GUI layout.
I have found two ways of signalling the existence of new data. If I use a signal connected to a slot in dataUpdate, everything works great. However, for efficiency's sake, I'd like to use a QWaitCondition. However, that means that the data processing code must run in an infinite loop in dataUpdate. And when I start this loop (by connecting to the thread start() signal), the thread only gets to start the first object's loop. Am I misunderstanding QWaitCondition? Can multiple QWaitConditions not run in a single thread?
thanks!
class DataObjectGL : QWidgetGL {
public:
DataUpdate : QObject
}
DataObjectGL :: DataObjectGL() {
dataUpdate = new DataUpdate();
dataUpdate->moveToThread(&GUIDataProcessThread);
}
I would like to generate an arbitrary (small) number of these objects depending on the GUI layout.
I have found two ways of signalling the existence of new data. If I use a signal connected to a slot in dataUpdate, everything works great. However, for efficiency's sake, I'd like to use a QWaitCondition. However, that means that the data processing code must run in an infinite loop in dataUpdate. And when I start this loop (by connecting to the thread start() signal), the thread only gets to start the first object's loop. Am I misunderstanding QWaitCondition? Can multiple QWaitConditions not run in a single thread?
thanks!