Suppose we have a file descriptor for a TCP socket. Is there a way to poll for data written to a socket (as opposed to data being available for reading, or the socket being available for writing)? i.e. if using poll, it would cause poll to wake up whenever somebody writes to that file descriptor?
In other words, say Thread A waits a while and then decides to write data to fd (perhaps after it has also ensured that POLLOUT is true). Is there a way for Thread B to discover that something has written to this file descriptor just now, without Thread A doing anything besides using normal system calls (and not signalling Thread B in any particular way) and in a blocking manner? (For example, one could monitor the TCP connection in a busy loop to see if more data has been written to the kernel buffers - but not what I'm talking about here).
The events available with poll seem to imply it's not possible with this function, but wondering if there's another way to do this or not. Is this possible in userspace (without mucking around in the kernel)?