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

Function use_invalid_keys_impl

test/bthread_key_unittest.cpp:203–216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

201void* const DUMMY_PTR = (void*)1;
202
203void use_invalid_keys_impl(const Keys* keys) {
204 ASSERT_EQ(NULL, bthread_getspecific(keys->invalid_key));
205 // valid key returns NULL as well.
206 ASSERT_EQ(NULL, bthread_getspecific(keys->valid_key));
207
208 // both pthread_setspecific(of nptl) and bthread_setspecific should find
209 // the key is invalid.
210 ASSERT_EQ(EINVAL, bthread_setspecific(keys->invalid_key, DUMMY_PTR));
211 ASSERT_EQ(0, bthread_setspecific(keys->valid_key, DUMMY_PTR));
212
213 // Print error again.
214 ASSERT_EQ(NULL, bthread_getspecific(keys->invalid_key));
215 ASSERT_EQ(DUMMY_PTR, bthread_getspecific(keys->valid_key));
216}
217
218void* use_invalid_keys(void* args) {
219 use_invalid_keys_impl(static_cast<const Keys*>(args));

Callers 1

use_invalid_keysFunction · 0.85

Calls 2

bthread_getspecificFunction · 0.85
bthread_setspecificFunction · 0.85

Tested by

no test coverage detected