| 54 | } |
| 55 | |
| 56 | int TokenPipeEnd::TokenRead() |
| 57 | { |
| 58 | uint8_t token; |
| 59 | while (true) { |
| 60 | ssize_t result = read(m_fd, &token, 1); |
| 61 | if (result < 0) { |
| 62 | // Failure. Check if the read was interrupted by a signal, |
| 63 | // in that case retry. |
| 64 | if (errno != EINTR) { |
| 65 | return TS_ERR; |
| 66 | } |
| 67 | } else if (result == 0) { |
| 68 | return TS_EOS; |
| 69 | } else { // ==1 |
| 70 | return token; |
| 71 | } |
| 72 | } |
| 73 | return token; |
| 74 | } |
| 75 | |
| 76 | void TokenPipeEnd::Close() |
| 77 | { |
no outgoing calls
no test coverage detected