Results 1 to 1 of 1

Thread: Odd things with threads

                  
   
  1. #1
    DCEmu Newbie
    Join Date
    Nov 2010
    Age
    33
    Posts
    1
    Rep Power
    0

    Question Odd things with threads

    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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. New shots of X-Blades, Things on Wheels, and Roogoo
    By 360fanboy11 in forum DCEmu Gaming & General Discussion Forum
    Replies: 0
    Last Post: May 9th, 2008, 22:40
  2. Five things Microsoft needs to do to fix the Zune
    By wraggster in forum Xbox News Forum
    Replies: 0
    Last Post: March 20th, 2007, 22:59

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •