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 

Switching to Multi-Threading = Crash

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



Joined: 17 Dec 2009
Posts: 39

PostPosted: Sat Jul 03, 2010 6:46 am    Post subject: Switching to Multi-Threading = Crash Reply with quote

Hello guys.
I have made a little single-threaded UDP socket client on PSP, to connect to the server com the PC.
Wonderful, everything went great.

Now, i fell the need to run that stuff on a thread, in order to run a server in another thread.
What I did was just wrap the old stuff on a callback function and start a thread with it.
When i run it on the PSP, the function is called, but the screen outputs just the firsts chars on the first printf(), and then freezes.

What I did:

[code]
int create_client()
{
//Conect to AP, get user input for server's address, send messages to the server
}

int client_thread()
{
thid = sceKernelCreateThread("client_thread", create_client, 0x18, 0x1000, 0, 0);
sceKernelStartThread(thid, 0, 0);
}

int main()
{
//Init everything

client_thread();

//Sleep 1000 ms

sceKernelSleepThread();


}
[/code]

Any tips?

Thanks in advance.
Back to top
View user's profile Send private message
Criptych



Joined: 12 Sep 2009
Posts: 79

PostPosted: Sat Jul 03, 2010 8:13 am    Post subject: Reply with quote

Not sure exactly what you're calling in the new thread, but 4kb isn't much room. Maybe you wanted 64kb (0x10000)?
_________________
PSP-2000 // CFW: 5.50 GEN-D2 ...and not upgrading until OFW supports homebrew!
(But I did downgrade to 1.50 with TimeMachine...)
"I want you to tell me how the machine makes you feel."
Back to top
View user's profile Send private message
lgnr



Joined: 17 Dec 2009
Posts: 39

PostPosted: Sat Jul 03, 2010 8:38 am    Post subject: Reply with quote

Dude, that just sad. Lost hours of my life on this.
Works perfect now. Thank you sir very much for helping idiots like myself. :)
Back to top
View user's profile Send private message
Criptych



Joined: 12 Sep 2009
Posts: 79

PostPosted: Sun Jul 04, 2010 12:52 am    Post subject: Reply with quote

lgnr wrote:
Dude, that just sad. Lost hours of my life on this.
Works perfect now. Thank you sir very much for helping idiots like myself. :)

No problem. I know this one from experience. :)
_________________
PSP-2000 // CFW: 5.50 GEN-D2 ...and not upgrading until OFW supports homebrew!
(But I did downgrade to 1.50 with TimeMachine...)
"I want you to tell me how the machine makes you feel."
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