Qthread or Qtimer is better.
-
-
1ms is overkill...
beside when you are not on a realtime system you can't ensure 1ms precision. -
As raven-worx pointed out, 1ms is not a good idea.
And to answer your question: use QTimer if it does not eat up too much of your main thread (the application runs smoothly), otherwise you can consider a thread - but then still you need a QTimer in there, to control the frequency of query checks.
-
i am not sure if i need Qtimer.
I want to check if a frame needs to transmitted and independence from the individual period of the frame. if the user wants a periodic frame every 3 ms, then the program needs to check if its time to send it.
For this reason, Qtimer or thread?
-
I would use a thread. You can call the msleep(3) function between sending frames in a loop. (i.e. <send><sleep><send><sleep> ...)
You might even be able to automatically calibrate the sleep time interval if you can measure how much time it takes to build and send the frame (to a resolution of 1ms which may not be good enough)
I don't know if you can achieve 3ms time periods reliably if you are trying to build something to auto calibrate. To measure you will need a high resolution timer (for example, GetTickCount() in windows has a resolution of 10-16ms which is not good enough).