Provide utilities to allow configuration of values for BCE.
More...
Namespaces |
namespace | bslmt |
Detailed Description
- Outline
-
-
- Purpose:
- Provide utilities to allow configuration of values for BCE.
-
- Classes:
-
- See also:
- Component bslmt_threadattributes, Component bslmt_threadutil
-
- Description:
- This component defines a utility
struct
, bslmt::Configuration
, that is a name space for pure functions used for providing access to, and configuring, default values for BCE-relevant parameters. The bslmt::Configuration
utility currently provides static methods to access and modify the BCE library's default stack size, as well as functions that access the platform's native default stack size and guard size. The BCE default stack size is initially configured to bslmt::ThreadAttributes::BSLMT_UNSET_STACK_SIZE
, in which case thread creation is to use the native default thread stack size.
-
- Usage:
- This section illustrates intended use of this component.
-
- Example 1: Demonstrate Accessing & Modifying the Default Thread Stack Size:
- In this example we demonstrate how to access both the platform's native and BCE configured default stack sizes, and then to set the default stack size used by BCE. Note that the value returned by
defaultThreadStackSize
may be adjusted from that provided by the underlying operating system to reflect the actual amount of stack memory available to a created thread. Note that operations creating a thread should perform a similar inverse adjustment when configuring the new thread's stack size (see bslmt_threadutil
).
- First, we examine the platform's native thread stack size: Then, we verify that
defaultThreadStackSize
is unset. Next, we define newDefaultStackSize
to some size other than the platform's native default stack size: const int newDefaultStackSize = nativeDefault * 2;
Now, we set the default size for BCE to the new size: Finally, we verify that BCE's default thread stack size has been set to the value we specified: