|
-
Nov 11th, 2003, 12:45 PM
#1
Thread Starter
Addicted Member
threading
to use threads, i could implement all methods on the same file?
i mean, i have one file with 5 diferent methods, all of them have a "while true" inside it, and inside the "While true" i have a "Thread.CurrentThread.Sleep(5000)" to sleep for 5 seconds each thread. Have some problem with it??
I think it have some problem, because it uses betwen 95% and 98% of the cpu!
Thank you,
Guilherme Costa
-
Nov 11th, 2003, 01:52 PM
#2
Loop is very CPU intense especially if just continuously loops and checks for a value. This is made worse if you are running all 5 methods at the sametime via threading. What is it you are trying to do? Or what exactly is the problem?
-
Nov 11th, 2003, 02:31 PM
#3
Thread Starter
Addicted Member
i have 4 serial ports connected to the PC, and i have to monitor some data that i recieve via serial.
that's why i have this four methodes, the fith will be soon implemented!
Thanks for any help,
Guilherme Costa
-
Nov 11th, 2003, 03:15 PM
#4
yay gay
instead of thread.sleep() why dont you just put all the code together in the same thread?
\m/  \m/
-
Nov 11th, 2003, 03:23 PM
#5
Alternatively you could just use a single timer and have it poll each method once per tick.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|