thread polling for timestamp on socket's error queue doesn't wake up

Ricardo Biehl rbpoficial at
Fri Nov 10 13:23:18 EST 2017

2017-11-10 15:29 GMT-02:00, valdis.kletnieks at <valdis.kletnieks at>:
> That seems reasonable.  Under what conditions would you want to receive an
> event for a packet that you haven't actually sent?  And how would an event
> related to a non-sent packet even be generated?

Yes, I've sent the packet :-) and I want the event (the timestamp) to be
received in another thread because the thread which has sent the packet wants to
send more packets while the kernel flushes the send queue.

> Or are you referring to sending a packet from one thread, generating an
> event that is then being received by a different thread?  And you're surprised
> that having received it in the other thread, it's no longer available in the
> first thread?  How would you solve that, other than keeping a near-infinite
> queue of events "just in case another thread wanted it"? (Although this sounds
> like a "well, don't do that, then" type of problem...)

Only one thread is polling. Look at the code I've sent.

Compile without SEND_IN_SAME_THREAD, use strace, and check if the poll() call
returns in thread B after the packet is sent in thread A. Here it doesn't.

However, when I compile with SEND_IN_SAME_THREAD the poll() returns on every
packet sent.

Ricardo Biehl Pasquali

More information about the Kernelnewbies mailing list