Re: [Dev-C++] Using MFC Timer Framework
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Bin Z. <bin...@ho...> - 2006-06-15 02:59:15
|
Thanks for the message. I do not think the feature was used correctly in our implementation. The system is a Win fat client to show stock tick data. Internally a data cache is used to store tick information for registered stock symbol. Once there is any tick data update, cached data will be updated. The timer is used by the user interface elements to read data again from the cache every 16 milliseconds. Also, some calculated results using the tick data will be published to message Q triggered at some intervals set through another timer event. Now I found the UI is extremely non-responsive. Clicking with mouse to select a UI element takes long time and during which the screen seems to be frozen. I think the design tried to avoid using multiple thread, but did not consider much on the impact flushing the timer with so high a frequent messages. Thanks, Bin -----Original Message----- From: Per Westermark [mailto:pw...@ia...] Sent: Wednesday, June 14, 2006 6:29 PM To: Bin Zhou Cc: dev...@li... Subject: Re: [Dev-C++] Using MFC Timer Framework You can't have events every 1 ms using the normal timers. The timer events does not stack but gets lost. Windows makes use of callbacks and messages to perform most of it's actions. The timers doesn't run in own threads. I don't know what you want to do, but windows is basically not designed to trigger actions every 1 ms. Some things - for example sound - may use hardware acceleration with buffering. One thing to look into a bit more are the multimedia timers available in Windows. They have better priority and granularity. However - don't abuse them. Make sure that the application really, really need high-speed timers before continuing with the coding! /Per W On Wed, 14 Jun 2006, Bin Zhou wrote: > Hi, > > I was just assigned to work on a MFC application using the MFC Timer > framework. Basically the application sets up several timer events. One > event is set to run every one millisecond. Because of the machine > constraints, it actually may get kicked off every 17 milliseconds if > no other things running. However, when some other operations of the > application are running, those other things may jump into the way. My questiona are: > > 1. whether each Timer event is set up to run in its own thread. > 2. if the timer triggered event takes longer to finish than the time > off value set, what will happen. Will those event be pilled up in the > message queue so that once the application gets a chance, it will go > back to pick them up. > > Thanks, > > Bin Zhou |