forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The thread which create by SDL_CreateThread work strange

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
newcreat



Joined: 24 Apr 2006
Posts: 5

PostPosted: Wed May 31, 2006 12:30 pm    Post subject: The thread which create by SDL_CreateThread work strange Reply with quote

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.
Back to top
View user's profile Send private message
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Wed May 31, 2006 1:41 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
newcreat



Joined: 24 Apr 2006
Posts: 5

PostPosted: Wed May 31, 2006 1:53 pm    Post subject: Reply with quote

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!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group