Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

A constantly running app

Posted on 2003-11-15
3
162 Views
Last Modified: 2013-11-20
Hi,

I am creating an app that will log stats for a game server that I run. The app will check the status of a fiile and if the file changes then the app will retrieve data from that file and add it to a database. The app will check this file once every minute and if the files changed then it does its thing. My question is this: What do I use as a timer ? Do I use just a simple timer to count down from 1 minute over and over again or is there a more efficient way to do this. I do not want to the program to eat up CPU time if possible.

thanks
0
Comment
Question by:LTLhawk
3 Comments
 
LVL 9

Expert Comment

by:Priyesh
ID: 9757650
If your app does not need an user interface, you could use a sleep to accomplish this. If it uses an user interface, using a timer would be best.
0
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 125 total points
ID: 9758265
SetTimer(1, 60000, NULL) should result in your app getting one WM_TIMER message every 60 seconds.  Next to no cpu overhead
0
 

Author Comment

by:LTLhawk
ID: 9758291
very good ideas..the app does not need a user interface so I will look into sleep. thank you very much people
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question