What's new

Thread issues

eqi

New member
Ok, well, I don't have a dual/quad core CPU, so would there be a big performance hit if I just used one thread instead of the standard loop like in a game (which takes my CPU usage up to 100%)?

I'm having this same problem , the loop for the cpu() emulation is taking 100% cpu usage , is there any way to do this infinite loop more efficient?

I have been searching the forums for a solution to this but i didn't find anything.:unsure:

Thanks!
 

Cyberman

Moderator
Moderator
Welcome to EmuTalk, if a thread is over a year old, please start a new thread instead of performing necromancy on one. People will answer just the same, as best they can.
Threads are tricky and are handled differently depending on OS and who are you compiler producer is. SO what compiler and VERSION of the compiler are you using (first off) I assume this is under win32? or is it Vista?

Cyb
 
OP
E

eqi

New member
thanks! , I got lower percent usage by including a sleep(1) between each call to the cpu, im using visual c++ express , is this the correct way to do it? using a sleep function?
 

Cyberman

Moderator
Moderator
Sleep gives up the thread execution to the processor and it will allocate more time to your main thread. Having a thread eat up lots of processing time by running as an idle loop (IE loop and loop) is not a good idea. Instead you should execute sleep and wait for a message for the thread. It's been a while but essentially that's what I did. I waited until something happened by giving up until the thread was woke up again (by a message).

Cyb
 

Top