| View previous topic :: View next topic |
| Author |
Message |
newcreat
Joined: 24 Apr 2006 Posts: 5
|
Posted: Wed May 31, 2006 12:30 pm Post subject: The thread which create by SDL_CreateThread work strange |
|
|
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 |
|
 |
jimparis
Joined: 10 Jun 2005 Posts: 1179 Location: Boston
|
Posted: Wed May 31, 2006 1:41 pm Post subject: |
|
|
| 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 |
|
 |
newcreat
Joined: 24 Apr 2006 Posts: 5
|
Posted: Wed May 31, 2006 1:53 pm Post subject: |
|
|
| 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 |
|
 |
|