So, I've been trying to use threads for audio streaming and it's been going slowly.
For some reason argp (which I use to pass my struct) gets mangled, and I'm not seeing why.
I wrote a simple app to test the pointers, here it is:
#include <pspkernel.h>
#include <pspdisplay.h>
#include <pspdebug.h>
#include <pspctrl.h>
#include "callbacks.h"
PSP_MODULE_INFO("ThreadTest", 0, 1, 1);
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | PSP_THREAD_ATTR_VFPU);
#define printf pspDebugScreenPrintf
int test_thread(SceSize args, void *argp)
{
printf("argp = %p\n", argp);
return 0;
};
int main(int argc, char *argv[])
{
pspDebugScreenInit();
setupCallbacks();
int thid = sceKernelCreateThread("test_thread", test_thread, 0x10, 0x400*24, PSP_THREAD_ATTR_USER, NULL);
int *p = &thid;
if(thid >= 0)
{
printf("thid pointer = %p\n", &p);
sceKernelStartThread(thid, 4, p);
}
sceKernelSleepThreadCB();
return 0;
};
I get the following output:
thid pointer = 0x9fbfe24
argp = 0x9ffeef0
any help would be great, thanks.
EDIT: code tags don't work...
EDIT:solved, turns out sceKernelStartThread doesn't just pass the pointer it memcopies it to a new location
Last edited by M_D_K; November 25th, 2010 at 16:36. Reason: removing code tags
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks