Quick Links:

bal | bbl | bdl | bsl

Namespaces

Component bslmt_fastpostsemaphoreimpl
[Package bslmt]

Provide a testable semaphore class optimizing post. More...

Namespaces

namespace  bslmt

Detailed Description

Outline
Purpose:
Provide a testable semaphore class optimizing post.
Classes:
bslmt::FastPostSemaphoreImpl testable semaphore class optimizing post
See also:
Component bslmt_fastpostsemaphore, Component bslmt_semaphore
Description:
This component defines a testable semaphore, bslmt::FastPostSemaphoreImpl, with the post operation being optimized at the potential expense of other operations. In particular, bslmt::FastPostSemaphoreImpl is an efficient synchronization primitive that enables sharing of a counted number of resources. bslmt::FastPostSemaphoreImpl supports the methods timedWait, enable, and disable in addition to the standard semaphore methods.
Commonly, during periods of time when the protected resource is scarce (the semaphore count is frequently zero) and threads are frequently blocked on wait methods, pessimizing the performance of the threads that block will have little effect on overall performance. In this case, optimizing post may be a performance improvement. Note that when the resource is plentiful, there are no blocked threads and we expect the differences between semaphore implementations to be trivial.
Supported Clock-Types:
bsls::SystemClockType supplies the enumeration indicating the system clock on which timeouts supplied to other methods should be based. If the clock type indicated at construction is bsls::SystemClockType::e_REALTIME, the absTime argument passed to the timedWait method should be expressed as an absolute offset since 00:00:00 UTC, January 1, 1970 (which matches the epoch used in bsls::SystemTime::now(bsls::SystemClockType::e_REALTIME). If the clock type indicated at construction is bsls::SystemClockType::e_MONOTONIC, the absTime argument passed to the timedWait method should be expressed as an absolute offset since the epoch of this clock (which matches the epoch used in bsls::SystemTime::now(bsls::SystemClockType::e_MONOTONIC).
Usage:
There is no usage example for this component since it is not meant for direct client use.