Click here to Skip to main content
15,894,410 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalwhy it dont work Pin
ANDYFA13-Oct-04 10:34
ANDYFA13-Oct-04 10:34 
GeneralRe: why it dont work Pin
Christian Graus13-Oct-04 10:50
protectorChristian Graus13-Oct-04 10:50 
GeneralRe: why it dont work Pin
David Crow13-Oct-04 10:52
David Crow13-Oct-04 10:52 
GeneralRe: why it dont work Pin
Maximilien13-Oct-04 11:19
Maximilien13-Oct-04 11:19 
GeneralRe: why it dont work Pin
Anonymous13-Oct-04 11:38
Anonymous13-Oct-04 11:38 
GeneralRe: why it dont work Pin
Maximilien13-Oct-04 13:16
Maximilien13-Oct-04 13:16 
GeneralRe: why it dont work Pin
Mad__14-Oct-04 0:45
Mad__14-Oct-04 0:45 
GeneralHelp me with thread performance Pin
Budric B.13-Oct-04 10:20
Budric B.13-Oct-04 10:20 
Hi,
I have a gui application. Originally the application is written such that all of the processing is done when you receive the OnIdle message. The performance was adequate and both the GUI and the process got enough resources such that the interface worked ok. I decided that it made more sense to move the processing from OnIdle into a separate thread in order to improve performance of the user interface. Unfortunately the opposite happened. Now the GUI is almost dead.

Here's a model of my program:
<br />
UINT Hog(LPVOID p)<br />
{<br />
	CThreadView * me = (CThreadView *) p;<br />
	return me->MyHog();<br />
}<br />
<br />
UINT CThreadView::MyHog()<br />
{<br />
	int x = 0;<br />
	while(1)<br />
	{<br />
		x = x*x;<br />
		//this->Invalidate();<br />
	}<br />
	return 0;<br />
}...<br />
AfxBeginThread(Hog, this);<br />
...<br />


First, that's a model, that's not my processing function. Second, there is A LOT of performance improvement if the thread is allowed to run without calling this->Invalidate(). But I need to update the graphical user interface based on what the thread has done. That is I need to repaint the CView.

I've also used SendMessage() (yes I'm aware of deadlock possibility) and PostMessage() to run a function in the "main" thread that just calls this->Invalidate. The performance sucks as well.

I don't have any critical sections/locks on the data so I don't think anyone is waiting.

Any suggestions?
GeneralRe: Help me with thread performance Pin
Joaquín M López Muñoz13-Oct-04 11:17
Joaquín M López Muñoz13-Oct-04 11:17 
GeneralRe: Help me with thread performance Pin
Michael Dunn13-Oct-04 20:22
sitebuilderMichael Dunn13-Oct-04 20:22 
GeneralRe: Help me with thread performance Pin
Henry miller14-Oct-04 2:24
Henry miller14-Oct-04 2:24 
GeneralRe: Help me with thread performance Pin
Blake Miller14-Oct-04 4:42
Blake Miller14-Oct-04 4:42 
GeneralRe: Help me with thread performance Pin
Budric B.14-Oct-04 6:39
Budric B.14-Oct-04 6:39 
QuestionCopying Files -- On the Right Track? Pin
Ian Bowler13-Oct-04 9:05
Ian Bowler13-Oct-04 9:05 
AnswerRe: Copying Files -- On the Right Track? Pin
David Crow13-Oct-04 10:33
David Crow13-Oct-04 10:33 
AnswerRe: Copying Files -- On the Right Track? Pin
Maximilien13-Oct-04 10:33
Maximilien13-Oct-04 10:33 
GeneralRe: Copying Files -- On the Right Track? Pin
Ian Bowler13-Oct-04 11:47
Ian Bowler13-Oct-04 11:47 
Generalpointer question Pin
Anonymous13-Oct-04 8:22
Anonymous13-Oct-04 8:22 
GeneralRe: pointer question Pin
Budric B.13-Oct-04 8:34
Budric B.13-Oct-04 8:34 
GeneralRe: pointer question Pin
Anonymous13-Oct-04 8:45
Anonymous13-Oct-04 8:45 
GeneralRe: pointer question Pin
TFrancis13-Oct-04 8:58
TFrancis13-Oct-04 8:58 
GeneralRe: pointer question Pin
Budric B.13-Oct-04 9:00
Budric B.13-Oct-04 9:00 
GeneralRe: pointer question Pin
Tyrus18213-Oct-04 17:17
Tyrus18213-Oct-04 17:17 
GeneralRe: pointer question Pin
Anonymous13-Oct-04 17:21
Anonymous13-Oct-04 17:21 
GeneralRe: pointer question Pin
Henry miller14-Oct-04 2:31
Henry miller14-Oct-04 2:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.