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 

Keep hanging on exit

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



Joined: 14 Feb 2007
Posts: 13

PostPosted: Mon Feb 19, 2007 3:15 am    Post subject: Keep hanging on exit Reply with quote

Hi people,

I keep having problems with my app hanging on exit, I get the "Please wait..." screen and it just never quits. I have tried adding the sceKernelDisplayWaitVblankStart() and sceKernelDelayThread(0) before and after sceKernelExitGame() but that didn't change anything. I've tried putting sceKernelExitGame in the exit callback function, but that didn't help. Now I've been trying to gracefully clean up the callback function and threads, but that doesn't seem to relieve the problem either. I've included the code I currently have below, I have run out of ideas and after going through 20 pages of the psp dev forum I haven't found anything to help me, (The search function is unavailable atm.) Could anybody say what I'm doing wrong, or what I could do to resolve the issue?

Code:
#include <pspkernel.h>
#include <pspdisplay.h>
#include <pspdebug.h>

PSP_MODULE_INFO("Test v1.0", 0, 1, 1);
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER);

bool done = false;

int exit_callback(int arg1, int arg2, void* common) {
   done = true;
   return 0;
}

int callback_thread(SceSize args, void* argp) {
   int cbid ;
      
   cbid = sceKernelCreateCallback("Exit Callback", exit_callback, 0);
   sceKernelRegisterExitCallback(cbid);

   sceKernelSleepThreadCB();

   return cbid;
}

int setup_callbacks() {
   int thid = 0;
   thid = sceKernelCreateThread("update_thread", callback_thread, 0x11, 0xFA0, THREAD_ATTR_USER, 0);

   if (0 <= thid)
      sceKernelStartThread(thid, 0, 0);

   return thid;
}

void deinit_callbacks(int thid) {
   sceKernelWakeupThread(thid);
   sceKernelWaitThreadEnd(thid, 0);
   int cbid = sceKernelGetThreadExitStatus(thid);
   //sceKernelUnregisterExitCallback();
   sceKernelDeleteCallback(cbid);
   sceKernelDeleteThread(thid);
}

int main(int argc, char** argv) {
   int cb_thread = setup_callbacks();

   while (!done) {
   }

   deinit_callbacks(cb_thread);

   sceDisplayWaitVblankStart();
   sceKernelExitGame();
   sceKernelDelayThread(0);
   sceKernelExitThread(0);

   return 0;
}
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