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

Function butex_player

test/bthread_ping_pong_unittest.cpp:100–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98}
99
100void* butex_player(void* void_arg) {
101 PlayerArg* arg = static_cast<PlayerArg*>(void_arg);
102 int counter = INITIAL_FUTEX_VALUE;
103 while (!stop) {
104 int rc = bthread::butex_wait(arg->wait_addr, counter, NULL);
105 ++counter;
106 ++*arg->wake_addr;
107 bthread::butex_wake(arg->wake_addr);
108 ++arg->counter;
109 arg->wakeup += (rc == 0);
110 }
111 return NULL;
112}
113
114TEST(PingPongTest, ping_pong) {
115 signal(SIGINT, quit_handler);

Callers

nothing calls this directly

Calls 2

butex_waitFunction · 0.85
butex_wakeFunction · 0.85

Tested by

no test coverage detected