Solved

CPU Usage

Posted on 2003-11-19
4
442 Views
Last Modified: 2013-11-20
hi@
I have an MFC application that does a FTP operation and after downloading parses the file. One thing I noticed in the operation is that till the application terminates the CPU is completely occupied and so all the other applications such as opening Internet Explorer or any windows operation just freezes.
IS there any way that I can make my application light weight without using Thread.Any function apart from Sleep that gives the other windows applications an equal share of CPU usage.

thanks
rahul
0
Comment
Question by:Rahulsaxena
[X]
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
  • 2
4 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 100 total points
ID: 9781683
You could use

SetThreadPriority ( GetCurrentThread (), THREAD_PRIORITY_IDLE);

to lower your main thread's priority.
0
 
LVL 6

Expert Comment

by:GloomyFriar
ID: 9789749
Why don't you like Sleep()?
0
 

Author Comment

by:Rahulsaxena
ID: 9790082
Because , Sleep just does'nt do anything with the CPU. it just stops the process, I was expecting the main thread to stop processing and process the event messages from the user.
I guess, I am left with two choices, Peek Message Loop or spawn a worker thread that processes the data and let the main thread respond to user events.

Anyways you question is quite amusing ;)
Yes, I like sleeping

0
 
LVL 6

Expert Comment

by:GloomyFriar
ID: 9795855
And it will be the answer ;-)
But I think that the additional thread is right thing in this case.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Suggested Solutions

Title # Comments Views Activity
Get filename and folder into excel 7 89
deburging in oracle form 12 119
unable to delete all specified values regedit 38 899
wordcount challenge 11 164
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…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

751 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