A bit off-topic, linux question

20 views
Skip to first unread message

Bill E

unread,
Feb 10, 2026, 9:57:57 AM (2 days ago) Feb 10
to [PiDP-1]
I've been going around and around trying to figure out why the lightpen code in pdp1.c hags when a display disconnects. Internally, a poll() for POLLIN status is done and if set a read is done. This is so it doesn't block on no lightpen data received.

What is happening is that poll() returns 1, which says there's an event.POLLIN is set in the response, no other event flags. This should mean data ready to read, right?
But, the read returns 0, nothing to read.
I didn't expect this, and kept looping because poll() kept saying there was data.

Ok, finally to the point, anyone know why this behavior is happening? It seems to contradict what the ooll documentation says. The file descriptor is a socket. I fixed the hang by explicitly checking that read actually returned something.

Bill

Guy Sotomayor

unread,
Feb 10, 2026, 10:26:06 AM (2 days ago) Feb 10
to Bill E, pid...@googlegroups.com
You always need to check to make sure you actually got data as part of the read.  Just like you need to make sure that all of the data being written made it (what you do when not all of the data is written depends on what you’re writing to).

TTFN - Guy

On Feb 10, 2026, at 6:57 AM, Bill E <wjegr...@gmail.com> wrote:


--
You received this message because you are subscribed to the Google Groups "[PiDP-1]" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pidp-1+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pidp-1/6bac7bce-f831-4868-a30c-5e46f88af7e3n%40googlegroups.com.

Bill E

unread,
Feb 10, 2026, 11:22:41 AM (2 days ago) Feb 10
to [PiDP-1]
Totally true, got sloppy. Fooled by what I thought poll() would take care of.
Bill
Reply all
Reply to author
Forward
0 new messages