text
stringlengths
0
2.2M
// Concern:
// That 'setDefaultThreadStackSize' is able to set the default thread
// stack size.
//
// Plan:
// Call 'setDefaultThreadStackSize' with a value that is not equal to
// 'nativeDefaultThreadStackSize' and then verify that the result of
// 'defaultThreadStackSize' has been set to the new value.
// --------------------------------------------------------------------
if (verbose) cout << "SETTING THE THREAD STACK SIZE\n"
"=============================\n";
// First, we examine the native thread stack size:
const int nativeDefault =
bslmt::Configuration::nativeDefaultThreadStackSize();
ASSERT(nativeDefault > 0);
// Then, we verify that 'defaultThreadStackSize' is unset.
ASSERT(bslmt::ThreadAttributes::e_UNSET_STACK_SIZE ==
bslmt::Configuration::defaultThreadStackSize());
// Next, we define 'newDefaultStackSize' to some size other than the
// native default size:
const int newDefaultStackSize = nativeDefault * 2;
// Now, we set the default size to the new size:
bslmt::Configuration::setDefaultThreadStackSize(newDefaultStackSize);
// Finally, we verify that the default thread stack size has been set
// to the value we specified:
ASSERT(bslmt::Configuration::defaultThreadStackSize() ==
newDefaultStackSize);
ASSERT(bslmt::Configuration::defaultThreadStackSize() !=
nativeDefault);
} break;
case 2: {
// --------------------------------------------------------------------
// RECOMMENDED THREAD STACK SIZE
//
// Concern:
// That 'recommendedThreadStackSize' returns a reasonable value and
// that the stack size can be set to that value on all platforms.
//
// Plan:
// Call 'recommendedDefaultThreadStackSize' and verify that the value
// is non-negative.
// --------------------------------------------------------------------
if (verbose) cout << "RECOMMENDED THREAD STACK SIZE\n"
"=============================\n";
const int recommended = Obj::recommendedDefaultThreadStackSize();
ASSERT(recommended > 0);
ASSERT(recommended < INT_MAX);
Obj::setDefaultThreadStackSize(recommended);
ASSERT(Obj::defaultThreadStackSize() == recommended);
} break;
case 1: {
// --------------------------------------------------------------------
// BREATHING TEST
//
// Concern:
// That, if 'setDefaultThreadStackSize' hasn't been called, that
// 'defaultThreadStackSize' equals 'nativeThreadStackSize'.o
//
// Plan:
// Call 'defaultThreadStackSize' and 'nativeThreadStackSize' without
// having called 'setDefaultThreadStackSize', and verify that they
// return the same value.
//
// Observed Results:
// So: Solaris
// AI: AIX
// HP: HPUX
// Li: Linux
// Wi: Windows
//
// So 32: defaultStackSize = 1048576, guardSize = 8192
// So 64: defaultStackSize = 2097152, guardSize = 8192
//
// AI 32: defaultStackSize = 98304, guardSize = 4096
// AI 64: defaultStackSize = 196608, guardSize = 4096
//
// HP 32: defaultStackSize = 131072, guardSize = 4096
// HP 64: defaultStackSize = 131072, guardSize = 4096
//
// Li 32: defaultStackSize = 67108864, guardSize = 4096
// Li 64: defaultStackSize = 67108864, guardSize = 4096
// --------------------------------------------------------------------
if (verbose) cout << "BREATHING TEST\n"
"==============\n";