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 

Noobish Question: sceKernelExitDeleteThread(int)

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



Joined: 11 Sep 2006
Posts: 5
Location: Worcester, MA

PostPosted: Mon Sep 18, 2006 11:43 am    Post subject: Noobish Question: sceKernelExitDeleteThread(int) Reply with quote

Hello,

Sometimes, I see an idiom for game exiting routines that involves a call like this:

* sceKernelExitDeleteThread(0)

In order to understand this, I wrote a program that not only initializes a main thread, but also another thread to run a simple socket server. I have found that the call above appears to terminate the main program thread; if another thread is running, it continues to run.

Question: is the appropriate way to close a multi-threaded program to do something like the following:

/* Exit callback */
int exit_callback(int arg1, int arg2, void *common)
{
/* exit some other thread I've created */
sceKernelExitDeleteThread(_thid);
/* exit main thread */
sceKernelExitDeleteThread(0);
sceKernelExitGame();
return 0;
}

? If not, can someone explain this -- I've looked through the sdk samples to no avail -- not much is there regarding PSP threading.

Thank you in advance,

~0
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
ZeroAltitude



Joined: 11 Sep 2006
Posts: 5
Location: Worcester, MA

PostPosted: Mon Sep 18, 2006 11:59 am    Post subject: Reply with quote

Nevermind, I think I got it. The argument is the status. This function deletes a thread in a particular thread context ('self'). Another call will delete the thread from outside of the running thread context.

~0
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
adrahil



Joined: 16 Mar 2006
Posts: 277

PostPosted: Mon Sep 18, 2006 8:46 pm    Post subject: Reply with quote

The functions are generally well documented in the headers...
Code:

/**
  * Exit a thread and delete itself.
  *
  * @param status - Exit status
  */
int sceKernelExitDeleteThread(int status);

http://svn.pspdev.org/filedetails.php?repname=psp&path=%2Ftrunk%2Fpspsdk%2Fsrc%2Fuser%2Fpspthreadman.h&rev=0&sc=1
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