Noobish Question: sceKernelExitDeleteThread(int)

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
ZeroAltitude
Posts: 5
Joined: Mon Sep 11, 2006 11:56 am
Location: Worcester, MA
Contact:

Noobish Question: sceKernelExitDeleteThread(int)

Post by ZeroAltitude »

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
ZeroAltitude
Posts: 5
Joined: Mon Sep 11, 2006 11:56 am
Location: Worcester, MA
Contact:

Post by ZeroAltitude »

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
adrahil
Posts: 274
Joined: Thu Mar 16, 2006 1:55 am

Post by adrahil »

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

Code: Select all

/** 
  * Exit a thread and delete itself.
  *
  * @param status - Exit status
  */
int sceKernelExitDeleteThread(int status);
http://svn.pspdev.org/filedetails.php?r ... rev=0&sc=1
Post Reply