PTHREAD_KEYS_MAX cleanup.
I fixed this bug a while back, but didn't remove it from the list, could have added a better test, and could have written clearer code that didn't require a comment. Change-Id: Iebdf0f9a54537a7d5cbca254a5967b1543061f3d
This commit is contained in:
@@ -33,6 +33,11 @@ TEST(pthread, pthread_key_create) {
|
||||
|
||||
#if !defined(__GLIBC__) // glibc uses keys internally that its sysconf value doesn't account for.
|
||||
TEST(pthread, pthread_key_create_lots) {
|
||||
// POSIX says PTHREAD_KEYS_MAX should be at least 128.
|
||||
ASSERT_GE(PTHREAD_KEYS_MAX, 128);
|
||||
// sysconf shouldn't return a smaller value.
|
||||
ASSERT_GE(sysconf(_SC_THREAD_KEYS_MAX), PTHREAD_KEYS_MAX);
|
||||
|
||||
// We can allocate _SC_THREAD_KEYS_MAX keys.
|
||||
std::vector<pthread_key_t> keys;
|
||||
for (int i = 0; i < sysconf(_SC_THREAD_KEYS_MAX); ++i) {
|
||||
|
Reference in New Issue
Block a user