thread problems

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

Post Reply
ntba2
Posts: 2
Joined: Thu Dec 01, 2005 9:24 pm
Contact:

thread problems

Post by ntba2 »

Hi,

I have several worker threads that are rotated by a scheduler thread whenever it is woken up by an alarm interrupt;
One that checks for gamepad input and updates the UI and another that decodes and streams an mp3.

The problem is when the UI thread makes a call to SifCallRpc it some times happens that it doesn't lose control and the mp3 thread starves. I think the alarm callback is not getting executed but I am not sure what's going on..

here is the code if anyone wants to take a look
http://ntba2.de/junk/scheduler.c
http://ntba2.de/junk/scheduler.h


ntba2
EEUG
Posts: 136
Joined: Fri May 13, 2005 4:49 am
Location: The Netherlands

Post by EEUG »

...I would try to alter "void Scheduler_Run( void )" function this way:

alarmID = SetAlarm( SCHEDULER_TIME_SLICE, Scheduler_Alarm, 0 );

while(1){
SleepTread ();
RotateThreadReadyQueue( SCHEDULER_PRIO_THREAD );
}

and 'Scheduler_Alarm' like this:

void Scheduler_Alarm( s32 id, u16 time, void *arg ) {
iWakeupThread ( Scheduler_RunThreadID );
}

...or even better to get rid of 'Scheduler_Run' function, and use only alarm handler to rotate therad queue. I'm not sure if it will work, it's just a suggestion :)
Best regards
Eugene
ntba2
Posts: 2
Joined: Thu Dec 01, 2005 9:24 pm
Contact:

Post by ntba2 »

Hi EEUG,

thanks I'll give that a try and see if it makes any difference
Post Reply