Oggplayer thread issues
Posted: Sat May 01, 2010 7:40 am
Does anyone here know of a thread problem with oggplayer and any workarounds?
I just added oggplayer to my game application based on the oggplayer example code that came with devkitPro. Before my main loop, I call PlayOgg to begin a long-running background music track. The program compiles and runs, but it crashes at a couple of places and dumps core. These crashes did not occur before I added oggplayer. They do not occur if I leave the program in its initial state, before entering the main loop, and let the track play to completion. They only occur after playing the game for about a minute while the track is playing.
Apologies for the "help me" thread. Without posting my whole 1000+ lines of (otherwise single-threaded) code, there's little to be gained from the context. Anyway, here's one of the cases on which it consistently crashes. It crashes on the "else" case of (turncounter < turnlength); in this case, it only modifies some variables local to the main function. Why would that fuss with the memory state of the oggplayer thread?
I just added oggplayer to my game application based on the oggplayer example code that came with devkitPro. Before my main loop, I call PlayOgg to begin a long-running background music track. The program compiles and runs, but it crashes at a couple of places and dumps core. These crashes did not occur before I added oggplayer. They do not occur if I leave the program in its initial state, before entering the main loop, and let the track play to completion. They only occur after playing the game for about a minute while the track is playing.
Apologies for the "help me" thread. Without posting my whole 1000+ lines of (otherwise single-threaded) code, there's little to be gained from the context. Anyway, here's one of the cases on which it consistently crashes. It crashes on the "else" case of (turncounter < turnlength); in this case, it only modifies some variables local to the main function. Why would that fuss with the memory state of the oggplayer thread?
Code: Select all
if (nextmove == 5) // it's P1's turn
{
determineHLTile(hlcursor0, cursor0_x, cursor0_y);
if ((wdown0 & WPAD_BUTTON_A) && (moves[hlcursor0[1]][hlcursor0[0]] == 17))
{
moves[hlcursor0[1]][hlcursor0[0]] = nextmove;
nextmove ^= 2; // flip the second-rightmost bit
turncounter = 0;
}
if (turncounter < turnlength)
{
turncounter++;
}
else
{
if (moves[hlcursor0[1]][hlcursor0[0]] == 17)
{
moves[hlcursor0[1]][hlcursor0[0]] = nextmove;
}
else
{
badmoveflag = 1;
}
nextmove ^= 2; // flip the second-rightmost bit
turncounter = 0;
}
}