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 

Running Multiple Threads Help

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



Joined: 22 Oct 2004
Posts: 62

PostPosted: Tue Jan 15, 2008 12:52 am    Post subject: Running Multiple Threads Help Reply with quote

I have searched around MSDN and the forums here, but I can't figure this out.

I have a program start, create multiple threads with the same priority, and everything goes well. My goal was to have one of these threads halt until I pressed a key on my keyboard. This thread communicates with my EE SIO cable and hyperterminal on my PC. The problem is, when my thread calls sio_getc(); in a while loop, it halts all of my other threads and main(); I know that SIOSHELL in the SVN idles in the background of the PS2 until the Enter key is pressed on the PC keyboard. It then takes control. When you type exit, it resumes control to the OS of the PS2. How could I set up this thread to do the same thing, without causing all of my other threads to halt? ANy help is appreciated. Thanks
Back to top
View user's profile Send private message
EEUG



Joined: 13 May 2005
Posts: 136
Location: The Netherlands

PostPosted: Tue Jan 15, 2008 3:45 am    Post subject: Reply with quote

...most probably you have your code like this:
Code:

while (   (  chr = sio_getc ()  ) < 0   );

try to change it to this:
Code:

while (   ( chr = sio_getc ()  ) < 0   ) RotateThreadReadyQueue ( <priority of your threads> );
Back to top
View user's profile Send private message
Derek8588



Joined: 22 Oct 2004
Posts: 62

PostPosted: Wed Jan 16, 2008 5:15 am    Post subject: Reply with quote

Wow, that works beautifully. Thank you so much. Such a simple solution.
Back to top
View user's profile Send private message
Derek8588



Joined: 22 Oct 2004
Posts: 62

PostPosted: Sun Jan 20, 2008 5:22 am    Post subject: Keeping em alive Reply with quote

I have been tinkering around with threads and can run multiple threads that do different things with no problem. How can I create a thread that runs within kernel memory, so when user memory is reset, it will continue to run? Thx
Back to top
View user's profile Send private message
misfire



Joined: 06 Sep 2004
Posts: 120
Location: Germany

PostPosted: Tue Jan 29, 2008 6:36 pm    Post subject: Reply with quote

This thread has some information about keeping code in RAM:
http://forums.ps2dev.org/viewtopic.php?t=5553
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 -> PS2 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