Re: Thread program makes Windows XP run slow,
- From: "Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp>
- Date: Wed, 16 Aug 2006 08:24:05 -0400
arun wrote:
Hi all,,
I am a newbie to this group. When i tried to write a simple program
using windows threads,
It is crashed. The program creates two threads of a function which
prints the string "hello" in an infinite while loop. The program caused
an "Access violation" in a routine called by printf.
But this problem happens only in Windows XP, it is running fine in
Windows 2000.
Also when i tried with a program that creates two thread of a
function which has an infinite while loop, the machine becomes really
slow, its almost hang. The cpu usage is shown as 95 by the windows task
manager.This problem also exists in Windows XP only.
I had tried both these using pthreads on my linux machine. Both are
running without any problem. Anyway now i am forced to use Windows as
my project requires it. It will be helpful if anyone can explain why
these problems occur,,
Thanking you all,,,
arun..
Make sure you have linked your program to the multithreaded version of the runtime library. In older versions of Visual C both a single threaded and multithread version of the library are available. Also use beginthreadex, not CreateThread, so your runtime lib will be properly initialized for each thread.
Writing an infinite while loop is SUPPOSED to consume 100% of CPU in Windows. What's the problem with that?
--
Scott McPhillips [VC++ MVP]
.
- References:
- Thread program makes Windows XP run slow,
- From: arun
- Thread program makes Windows XP run slow,
- Prev by Date: Thread program makes Windows XP run slow,
- Next by Date: Anti-crack and anti-piracy application protection and licensing solution using code morphing.
- Previous by thread: Thread program makes Windows XP run slow,
- Next by thread: Re: Thread program makes Windows XP run slow,
- Index(es):
Relevant Pages
|