Click here to Skip to main content
15,912,977 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Converting char to char* Pin
David Crow4-May-05 6:07
David Crow4-May-05 6:07 
GeneralRe: Converting char to char* Pin
talkster54-May-05 6:17
talkster54-May-05 6:17 
GeneralRe: Converting char to char* Pin
talkster54-May-05 6:21
talkster54-May-05 6:21 
GeneralRe: Converting char to char* Pin
John R. Shaw4-May-05 9:55
John R. Shaw4-May-05 9:55 
GeneralSetTimer() in Serial Comm Program Question Pin
CNewbie3-May-05 7:59
CNewbie3-May-05 7:59 
GeneralRe: SetTimer() in Serial Comm Program Question Pin
Trollslayer3-May-05 12:28
mentorTrollslayer3-May-05 12:28 
GeneralRe: SetTimer() in Serial Comm Program Question Pin
John R. Shaw4-May-05 11:10
John R. Shaw4-May-05 11:10 
GeneralRe: SetTimer() in Serial Comm Program Question Pin
CNewbie4-May-05 11:24
CNewbie4-May-05 11:24 
thank you for the detailed response. In my original post I failed to mention that I am using shared buffers and as you mentioned it is much better then using one buffer.

I have been doing some debugging of the cpu hogging problem and it has come down to be either the infinite for loop that is causing it or the actual worker thread itself.

I call the worker thread like this:

AfxBeginThread(Read,this);

Read() is a static menber function declared as:

afx_msg static UINT Read(LPVOID param);

As I was told this was how it was supposed to be declared. Here is the Read() function minus the background work:

<br />
UINT CprogramDlg::Read(LPVOID param)<br />
{<br />
	for( ;; ) {}<br />
	return 0;<br />
}<br />


Reason I am not including the code within the "for" loop is because after testing I have concluded that even with just the code like this when the Read() function is called from AfxBeginThread() the cpu immediately shoots up to 99% and stays there.

So from this I have to conclude that it is either the "infinite for loop" that is causing it or it is the actual thread call that is doing it. It was pointed out to me that an infinite loop in a worker thread "should not" cause the cpu usage to jump up completely like that, but I dont know how true that is. I just want to make sure that it is the infinite loop before I move onto fix the problem by using a timer.

Thanks
GeneralRe: SetTimer() in Serial Comm Program Question Pin
John R. Shaw4-May-05 12:09
John R. Shaw4-May-05 12:09 
GeneralCreating a dll using a type library Pin
ChicoM3-May-05 7:51
ChicoM3-May-05 7:51 
GeneralMulti arrays Pin
bitsNbites3-May-05 6:29
bitsNbites3-May-05 6:29 
GeneralRe: Multi arrays Pin
David Crow3-May-05 6:47
David Crow3-May-05 6:47 
GeneralRe: Multi arrays Pin
bitsNbites3-May-05 7:52
bitsNbites3-May-05 7:52 
GeneralRe: Multi arrays Pin
David Crow3-May-05 8:01
David Crow3-May-05 8:01 
GeneralRe: Multi arrays Pin
Priyank Bolia3-May-05 19:52
Priyank Bolia3-May-05 19:52 
GeneralRe: Multi arrays Pin
bitsNbites4-May-05 15:42
bitsNbites4-May-05 15:42 
GeneralRe: Multi arrays Pin
Priyank Bolia4-May-05 18:19
Priyank Bolia4-May-05 18:19 
GeneralPlease help me. Pin
dSolariuM3-May-05 6:12
dSolariuM3-May-05 6:12 
GeneralRe: Please help me. Pin
David Crow3-May-05 6:50
David Crow3-May-05 6:50 
GeneralRe: Please help me. Pin
dSolariuM16-May-05 6:35
dSolariuM16-May-05 6:35 
GeneralFile Version Pin
picasso23-May-05 6:01
picasso23-May-05 6:01 
GeneralRe: File Version Pin
David Crow3-May-05 7:05
David Crow3-May-05 7:05 
GeneralRe: File Version Pin
Blake Miller3-May-05 7:26
Blake Miller3-May-05 7:26 
GeneralRich edit control problem Pin
bluehai3-May-05 5:38
bluehai3-May-05 5:38 
GeneralRe: Rich edit control problem Pin
David Crow3-May-05 5:41
David Crow3-May-05 5:41 

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.