Running Multiple Threads Help

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

Post Reply
Derek8588
Posts: 62
Joined: Fri Oct 22, 2004 2:14 pm

Running Multiple Threads Help

Post by Derek8588 »

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
EEUG
Posts: 136
Joined: Fri May 13, 2005 4:49 am
Location: The Netherlands

Post by EEUG »

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

Code: Select all

while &#40;   &#40;  chr = sio_getc &#40;&#41;  &#41; < 0   &#41;;
try to change it to this:

Code: Select all

while &#40;   &#40; chr = sio_getc &#40;&#41;  &#41; < 0   &#41; RotateThreadReadyQueue &#40; <priority of your threads> &#41;;
Derek8588
Posts: 62
Joined: Fri Oct 22, 2004 2:14 pm

Post by Derek8588 »

Wow, that works beautifully. Thank you so much. Such a simple solution.
Derek8588
Posts: 62
Joined: Fri Oct 22, 2004 2:14 pm

Keeping em alive

Post by Derek8588 »

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
misfire
Posts: 110
Joined: Mon Sep 06, 2004 7:53 am
Location: Germany

Post by misfire »

This thread has some information about keeping code in RAM:
http://forums.ps2dev.org/viewtopic.php?t=5553
Post Reply