| 193 | } |
| 194 | |
| 195 | void* client_thread(void* arg) { |
| 196 | ClientMeta* m = (ClientMeta*)arg; |
| 197 | for (size_t i = 0; i < m->times; ++i) { |
| 198 | if (write(m->fd, &m->count, sizeof(m->count)) != sizeof(m->count)) { |
| 199 | LOG(FATAL) << "Should not happen in this test"; |
| 200 | return NULL; |
| 201 | } |
| 202 | #ifdef RUN_CLIENT_IN_BTHREAD |
| 203 | ssize_t rc; |
| 204 | do { |
| 205 | # if defined(OS_LINUX) |
| 206 | const int wait_rc = bthread_fd_wait(m->fd, EPOLLIN); |
| 207 | # elif defined(OS_MACOSX) |
| 208 | const int wait_rc = bthread_fd_wait(m->fd, EVFILT_READ); |
| 209 | # endif |
| 210 | EXPECT_EQ(0, wait_rc) << berror(); |
| 211 | rc = read(m->fd, &m->count, sizeof(m->count)); |
| 212 | } while (rc < 0 && errno == EAGAIN); |
| 213 | #else |
| 214 | ssize_t rc = read(m->fd, &m->count, sizeof(m->count)); |
| 215 | #endif |
| 216 | if (rc != sizeof(m->count)) { |
| 217 | PLOG(FATAL) << "Should not happen in this test, rc=" << rc; |
| 218 | return NULL; |
| 219 | } |
| 220 | } |
| 221 | return NULL; |
| 222 | } |
| 223 | |
| 224 | inline uint32_t fmix32 ( uint32_t h ) { |
| 225 | h ^= h >> 16; |
nothing calls this directly
no test coverage detected