Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 

 Home / General Programming / Multithreading to recieve keyboard inputs? Account Manager
 
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
 
ShrederX

February 08, 2005, 08:53 PM

Hey, I followed the Multithreading tutorial on your site which was quite easy. Now i have the problem that i instantiate an instance of the cThread class and begin a thread how do i link commands to the thread ie. a button push that starts some computations or output to a com port. I have had help before on multithreading part of projects where there was messages and stuff in the message map and no class definition functions to work in a thread. I want to create a thread to activily monitor for input recieved from a com port and also have a worker thread to output to the com port not neccsarily at the same time right now. Help would be great on this as i have to go back into lab tommorow morning and start working this through. Hit me up on aol if you want : Shr3d3rX

THANKS!!

 
Floyd

February 08, 2005, 09:30 PM

Multithreading is non-trivial. You may be better off to keep things singlethreaded and use overlapped I/O by means of ReadFile or ReadFileEx (assuming you're targeting Windows platforms).

.f

 
ShrederX

February 08, 2005, 09:33 PM

yes i'm using CSerialPort class i got from codeproject.com it makes interacting with the com port very easy and user-friendly. The problem is that fact that multi-threading is a requirement of this design project. We are reading data in from a PS/2 keyboard through a proto-board to the computer through serial port and then outputting data through the serial port to a LCD where it displays text. All this wrapped into a Hangman game also. So my thoughts were create a thread for constantly monitoring the keyboard from the com port to pick up keystrokes. In past projects i've had infinite while loops in a thread that were broken out to kill the thread. This one presented a new problem of a constant running thread and I found this sites tutorial to be quite simple and to the point.

Thanks

 
This thread contains 3 messages.
 
 
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.