CSC209H1 Lecture Notes - Lecture 10: Bitwise Operation, Ampersand, Operand
Document Summary
0b00010011: you can also use hexadecimal constants, prefaced with 0x, ex. If we use each bit in a variable to denote the presence -- or absence -- of a particular element in the set, then we have a very compact implementation that can use fast boolean instructions as set operations. This macro initializes the set of descriptors to be empty. Only contain the file descriptors that are ready: so we need to use another set operation - checking set membership - to determine which descriptors remain in the set. The macro fd_isset takes a single fd and returns whether or not it is in the fdset pointed to by the second parameter. So in our case, we want to know if the pipe from child 1 is in read_fds after the select call. If it *is* in the set, then we know that this pipe is ready, so we can read from it without fear of blocking.