Re: 2.0.30 serial.c, ppp.c and pppd-2.2 questions

Keith Rohrer (kwrohrer@uiuc.edu)
Wed, 23 Jul 1997 00:07:36 -0500


Theodore Y. Ts'o wrote:
> The patch you submitted doesn't work, because it uses a static variable,
> flip_overflow. If you have multiple serial ports active, they will all
> try to reference same flip_overflow variable while the interrupt routine
> is executing, with really bad results.
>
> (Insert standard claim about why I think threads are a bad idea for most
> application programs; there are plenty of kernel programmers have a hard
> time writing thread-safe kernel code --- and we expect *application*
> programmers to be able to get this stuff right? It's like handing a
> loaded .45 to a chimpanzee and hoping he won't shoot himself or others
> while he's playing with it. :-)
However, the error you mention has nothing to do with threads; the error
was making a variable static to a function when it should be a member of
whatever struct you're using to keep track of the serial port the
function is sicced on.

> (Yes, I know sometimes you need threads for performance reasons; but you
> better have someone who really knows what they are doing, and the times
> when you need threads are much rarer than you think.)
I just wrote a VOD server for my MS research, and went with heavyweight
processes and shmget...but made myself write in such a way that I could
switch to thr_create and malloc without changing any other code or
causing bugs. It wasn't hard at all once I had a good set of modules
established, but then again I may be good.

Keith (app programmer = kernel programmer - legacy code)

-- 
The wisdom of G'Kar:
Bad Guys make a very satisfying THUMP when they hit the
ground.  But to thump the book of G'Quan is disrespectful.