2

I can test this to find the behavior but that's not the point. In my answer to another question, a commenter recommended closing a monitored fd from another thread to wake up select. Another commenter couldn't find a reference to this behavior in the standard, and I can't find one either.

Can someone provide a pointer to the standard on this behavior?

Community
  • 1
  • 1
bstpierre
  • 30,042
  • 15
  • 70
  • 103

1 Answers1

2

From the description of select in "The Open Group Base Specifications Issue 7":

A descriptor shall be considered ready for reading when a call to an input function with O_NONBLOCK clear would not block, whether or not the function would transfer data successfully. (The function might return data, an end-of-file indication, or an error other than one indicating that it is blocked, and in each of these cases the descriptor shall be considered ready for reading.)

So, I would say this method is portable.

sl0815
  • 567
  • 1
  • 9
  • 21