The thread which create by SDL_CreateThread work strange

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
newcreat
Posts: 5
Joined: Mon Apr 24, 2006 3:09 pm

The thread which create by SDL_CreateThread work strange

Post by newcreat »

I create a thread: the thread may use a lot of CPU time

globle var progressbar=0;
main()
{
create The thread;
while(progressbar!=100)
draw the progressbar
}
the thread like this:
Thread()
{
computing..
update progressbar value;//has process 10%
.......
computing..
update progressbar value;//has process 100%

}
I find it work fine on Windows,but it is dosen't work on PSP.
On PSP the main is freezing until the thread return .
I dont know why?
thx for your help.
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

The PSP does not do preemptive multithreading. The kernel will only switch threads when you call certain functions -- an easy way to ensure it can switch to a new thread is to call SDL_Delay(0) periodically.
newcreat
Posts: 5
Joined: Mon Apr 24, 2006 3:09 pm

Post by newcreat »

jimparis wrote:The PSP does not do preemptive multithreading. The kernel will only switch threads when you call certain functions -- an easy way to ensure it can switch to a new thread is to call SDL_Delay(0) periodically.
thank you very much,I'll try it!
Post Reply