Page 1 of 1

Running Multiple Threads Help

Posted: Tue Jan 15, 2008 12:52 am
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

Posted: Tue Jan 15, 2008 3:45 am
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;;

Posted: Wed Jan 16, 2008 5:15 am
by Derek8588
Wow, that works beautifully. Thank you so much. Such a simple solution.

Keeping em alive

Posted: Sun Jan 20, 2008 5:22 am
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

Posted: Tue Jan 29, 2008 6:36 pm
by misfire
This thread has some information about keeping code in RAM:
http://forums.ps2dev.org/viewtopic.php?t=5553