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