[Python-bugs-list] PRIVATE: Threads and readline (PR#120)
Wed, 03 Nov 1999 23:32:19 +0100
> As another bizarre data point: when I run a threaded python interpreter
> on a program which does not use threads, and pipe the output to less,
> less gets very confused and fails to update about half the screen,
> leaving it blank. This happens after hitting SPACE a couple of times.
> All the data is there, and if I jump less to the end of input and then
> go back through the the data, I can see it all normally. Same program
> and unthreaded python and less works just fine. If you have ANY idea
> why adding thread support could affect a program further down a pipe I'd
> love to know.
As I like puzzles I spent some time thinking on this, and it must be
either (a) kernel bug, (b) a very strange stdio bug or (c) an incorrect
observation. If your system supports memory-mapped I/O and stdio uses
it and it can somehow signal that a whole buffer is available while it
isn't but only the tail end is available (because it uses an
overlapping memcopy which goes back-to-front, for instance) the reader
in the pipe might wakeup too early and see null bytes. But if this was
a bet I think I'd put my money on (c) (but absolutely no offense meant!).
Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++
www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm