MCPcopy Create free account
hub / github.com/apache/brpc / wait_butex

Function wait_butex

test/bthread_butex_unittest.cpp:195–207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

193};
194
195void* wait_butex(void* void_arg) {
196 ButexWaitArg* arg = static_cast<ButexWaitArg*>(void_arg);
197 const timespec ts = butil::milliseconds_from_now(arg->wait_msec);
198 int rc = bthread::butex_wait(arg->butex, arg->expected_val, &ts);
199 int saved_errno = errno;
200 if (arg->error_code) {
201 EXPECT_EQ(-1, rc);
202 EXPECT_EQ(arg->error_code, saved_errno);
203 } else {
204 EXPECT_EQ(0, rc);
205 }
206 return NULL;
207}
208
209TEST(ButexTest, wait_without_stop) {
210 int* butex = bthread::butex_create_checked<int>();

Callers

nothing calls this directly

Calls 2

milliseconds_from_nowFunction · 0.85
butex_waitFunction · 0.85

Tested by

no test coverage detected