Note that there are some explanatory texts on larger screens.

plurals
  1. POTimer Queues, immediately terminate a timer?
    primarykey
    data
    text
    <p>I'm trying to achieve high frame-per-second on Windows GDI by using Windows Timer Queues. The relevant APIs are <code>CreateTimerQueue, DeleteTimerQueueEx, CreateTimerQueueTimer,</code> and <code>DeleteTimerQueueTimer</code> .</p> <p>The timer is created using <code>CreateTimerQueueTimer(&amp;m_timer, m_timer_queue, TimerCallback, this, 0, 20, WT_EXECUTEINTIMERTHREAD);</code> to achieve some 50fps of speed. GDI operations (some painting in the backstore, plus InvalidateRect) cannot be asynchronous, therefore I can't choose other flags but WT_EXECUTEINTIMERTHREAD so that no extra sync op is required on the drawing code. The idea is to achieve 50fps when possible, and when it's not, just show each frame at the maximum possible speed.</p> <p>At the end of the animation (reached a total frame count), <code>DeleteTimerQueueTimer</code> is called to destroy the timer.</p> <p>The problem is that <code>DeleteTimerQueueTimer</code> doesn't immediately turn off the callings of the callback function. When it's not possible to achieve the 50fps requirement, the timer pumps the call into a queue. Calling <code>DeleteTimerQueueTimer</code> inside the callback function doesn't destroy the queue. As a result, the callback is still being called even though it decided to shutdown the timer.</p> <p>How do I deal with this problem?</p> <p>- On another note, the old <code>timeSetEvent / timeKillEvent</code> multimedia API doesn't seem to have this problem. There are no queues and the calling of the callback function is immediately stopped when I call timeKillEvent. Is it possible to achieve the same behavior with timer queues?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload