
Zeljko Vrba wrote:
On Mon, Mar 17, 2008 at 12:18:05PM -0400, Hal Vaughan wrote:
So there's nothing I can use to try to split time evenly between them?
No and yes. Yes, if you use POSIX realtime scheduling and SCHED_RR policy. But this is rather advanced, and if you have a bug in your program, nothing else will get to run, i.e. you will end up with a locked-up machine.
Okay, don't want to get that deep at this point. I'm learning C++ specifically for this project. I've enjoyed doing this more than any coding I've done in 3-4 years since I'm learning new stuff and like the low level abilities C++ gives me, but as far as this project goes, I do want it done without me jumping into something to deep if I can avoid it. I'd rather learn more o my own stuff when I can putter around more.
bad idea. If the port gets extra data while I'm doing something else, won't it store in the buffer?
Yes. But the question is -- when the data from the buffer will be delivered to the application. Or vice-versa: when you send something to the stream, when will it be delivered to the device?
Here's what's odd, and I know this is Linux specific, so I don't know if people want details for info or want me to shut up because it's OT: I open the port twice. I've tested this and it works. I read the data from the port using an ifstream object and to write to it, I use just plain open() and write() to write to the device. It's worked just fine with the RS232 port (but did get funky on the USB port at one point). The data comes in from the port instantly (or so fast I can't tell the difference) and since I'm not using a buffer when I write, it goes in instantly as well. For some reason, though, I can't read from the serial port with just open() and read().
That may help, but in the long run, there are people that might be using this in connection with a GUI. How do I make sure my stuff doesn't take up all the resources? Or is that partly the GUI programmer's job? To split
You don't, that's the kernel's job.
Gotcha! Nice when someone else has to do the ugly work! ;-) Hal