![]() |
| | #1 |
| Registered User Join Date: Jun 2009
Posts: 34
| Using threads for control input (keyboard, serial) The value they set in the calling thread's variable determines its course of action. The calling thread itself is in a loop (constantly reading this variable). This seems to be working okay so far, but is there a better way to do this? I suppose I could put the checks for key and serial port input in the main loop, but what advantage would that offer? As I mentioned, the main loop just constantly checks a variable, so what does it matter whether it's set by its own loop or by some other thread? |
| synthetix is offline | |
| | #2 |
| Senior software engineer Join Date: Mar 2007 Location: Portland, OR
Posts: 5,378
| Threads seem like massive overkill. Use select().
__________________ "Congratulations on your purchase. To begin using your quantum computer, set the power switch to both off and on simultaneously." -- raftpeople@slashdot |
| brewbuck is online now | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| About aes | gumit | C Programming | 13 | 10-24-2006 03:42 PM |
| Catching All Keyboard Input | nigma | C Programming | 6 | 06-11-2005 02:35 AM |
| Keyboard input in a Dialog | ksarkar | C++ Programming | 1 | 05-20-2005 05:39 AM |
| getting input from keyboard, passing to execvp | jumpyg | C++ Programming | 4 | 11-02-2003 08:49 PM |
| serial programming, threads and dynamic buffer | lectrolux | C Programming | 1 | 05-06-2003 09:59 AM |