BDE 4.39.x Production Release
Loading...
Searching...
No Matches
bslmt_fastpostsemaphore.h
Go to the documentation of this file.
1/// @file bslmt_fastpostsemaphore.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// bslmt_fastpostsemaphore.h -*-C++-*-
8
9#ifndef INCLUDED_BSLMT_FASTPOSTSEMAPHORE
10#define INCLUDED_BSLMT_FASTPOSTSEMAPHORE
11
12#include <bsls_ident.h>
13BSLS_IDENT("$Id: $")
14
15/// @defgroup bslmt_fastpostsemaphore bslmt_fastpostsemaphore
16/// @brief Provide a semaphore class optimizing `post`.
17/// @addtogroup bsl
18/// @{
19/// @addtogroup bslmt
20/// @{
21/// @addtogroup bslmt_fastpostsemaphore
22/// @{
23///
24/// <h1> Outline </h1>
25/// * <a href="#bslmt_fastpostsemaphore-purpose"> Purpose</a>
26/// * <a href="#bslmt_fastpostsemaphore-classes"> Classes </a>
27/// * <a href="#bslmt_fastpostsemaphore-description"> Description </a>
28/// * <a href="#bslmt_fastpostsemaphore-supported-clock-types"> Supported Clock-Types </a>
29/// * <a href="#bslmt_fastpostsemaphore-usage"> Usage </a>
30/// * <a href="#bslmt_fastpostsemaphore-example-1-a-simple-queue"> Example 1: A Simple Queue </a>
31///
32/// # Purpose {#bslmt_fastpostsemaphore-purpose}
33/// Provide a semaphore class optimizing `post`.
34///
35/// # Classes {#bslmt_fastpostsemaphore-classes}
36///
37/// - bslmt::FastPostSemaphore: semaphore class optimizing `post`
38///
39/// @see bslmt_semaphore
40///
41/// # Description {#bslmt_fastpostsemaphore-description}
42/// This component defines a semaphore, `bslmt::FastPostSemaphore`,
43/// with the `post` operation being optimized at the potential expense of other
44/// operations. In particular, `bslmt::FastPostSemaphore` is an efficient
45/// synchronization primitive that enables sharing of a counted number of
46/// resources. `bslmt::FastPostSemaphore` supports the methods `timedWait`,
47/// `enable`, and `disable` in addition to the standard semaphore methods.
48///
49/// Commonly, during periods of time when the protected resource is scarce (the
50/// semaphore count is frequently zero) and threads are frequently blocked on
51/// wait methods, pessimizing the performance of the threads that block will
52/// have little effect on overall performance. In this case, optimizing `post`
53/// *may* be a performance improvement. Note that when the resource is
54/// plentiful, there are no blocked threads and we expect the differences
55/// between semaphore implementations to be trivial.
56///
57/// ## Supported Clock-Types {#bslmt_fastpostsemaphore-supported-clock-types}
58///
59///
60/// `bsls::SystemClockType` supplies the enumeration indicating the system clock
61/// on which timeouts supplied to other methods should be based. If the clock
62/// type indicated at construction is `bsls::SystemClockType::e_REALTIME`, the
63/// `absTime` argument passed to the `timedWait` method should be expressed as
64/// an *absolute* offset since 00:00:00 UTC, January 1, 1970 (which matches the
65/// epoch used in `bsls::SystemTime::now(bsls::SystemClockType::e_REALTIME)`.
66/// If the clock type indicated at construction is
67/// `bsls::SystemClockType::e_MONOTONIC`, the `absTime` argument passed to the
68/// `timedWait` method should be expressed as an *absolute* offset since the
69/// epoch of this clock (which matches the epoch used in
70/// `bsls::SystemTime::now(bsls::SystemClockType::e_MONOTONIC)`.
71///
72/// ## Usage {#bslmt_fastpostsemaphore-usage}
73///
74///
75/// This section illustrates intended use of this component.
76///
77/// ### Example 1: A Simple Queue {#bslmt_fastpostsemaphore-example-1-a-simple-queue}
78///
79///
80/// This example illustrates a very simple fixed-size queue where potential
81/// clients can push integers to a queue, and later retrieve the integer values
82/// from the queue in FIFO order. Also, `waitUntilEmpty` is implemented to
83/// depict the common usage of `getDisabledState`.
84///
85/// First, we define the `IntQueue` class:
86/// @code
87/// /// FIFO queue of integer values.
88/// class IntQueue {
89///
90/// // DATA
91/// bsl::vector<int> d_data; // queue values
92///
93/// bslmt::FastPostSemaphore d_pushSem; // resource availability
94/// // for push
95///
96/// bslmt::FastPostSemaphore d_popSem; // resource availability
97/// // for pop
98///
99/// bsls::AtomicUint d_pushIdx; // index to push to
100///
101/// bsls::AtomicUint d_popIdx; // index to pop from
102///
103/// mutable bslmt::Mutex d_emptyMutex; // blocking point for
104/// // 'waitUntilEmpty'
105///
106/// mutable bslmt::Condition d_emptyCondition; // condition variable for
107/// // 'waitUntilEmpty'
108///
109/// private:
110/// // NOT IMPLEMENTED
111/// IntQueue(const IntQueue&);
112/// IntQueue& operator=(const IntQueue&);
113///
114/// public:
115/// // PUBLIC CONSTANTS
116/// enum ReturnValue {
117/// e_SUCCESS = bslmt::FastPostSemaphore::e_SUCCESS, // indicates
118/// // success
119///
120/// e_DISABLED = bslmt::FastPostSemaphore::e_DISABLED, // indicates
121/// // queue is
122/// // disabled
123///
124/// e_FAILED = bslmt::FastPostSemaphore::e_FAILED // indicates
125/// // failure
126/// };
127///
128/// // CREATORS
129///
130/// /// Create an `IntQueue` object with the specified `capacity`.
131/// /// Optionally specify a `basicAllocator` used to supply memory. If
132/// /// `basicAllocator` is 0, the currently installed default allocator
133/// /// is used.
134/// explicit
135/// IntQueue(bsl::size_t capacity, bslma::Allocator *basicAllocator = 0);
136///
137/// /// Destroy this object.
138/// //! ~IntQueue() = default;
139///
140/// // MANIPULATORS
141///
142/// /// Disable dequeueing from this queue. All subsequent invocations
143/// /// of `popFront` and `waitUntilEmpty` will fail immediately. All
144/// /// blocked invocations of `popFront` and `waitUntilEmpty` will fail
145/// /// immediately. If the queue is already dequeue disabled, this
146/// /// method has no effect.
147/// void disablePopFront();
148///
149/// /// Enable dequeuing. If the queue is not dequeue disabled, this method
150/// /// has no effect.
151/// void enablePopFront();
152///
153/// /// Remove the element from the front of this queue and load that
154/// /// element into the specified `value`. If the queue is empty,
155/// /// block until it is not empty. Return 0 on success, and a nonzero
156/// /// value if the queue is disabled.
157/// int popFront(int *value);
158///
159/// /// Append the specified `value` to the back of this queue, blocking
160/// /// until either space is available - if necessary - or the queue is
161/// /// disabled. Return 0 on success, and a nonzero value if the queue
162/// /// is disabled.
163/// int pushBack(int value);
164///
165/// // ACCESSORS
166///
167/// /// Block until all the elements in this queue are removed. Return
168/// /// 0 on success, and a non-zero value if the queue is not empty and
169/// /// `isPopFrontDisabled()`. A blocked thread waiting for the queue
170/// /// to empty will return a non-zero value if `disablePopFront` is
171/// /// invoked.
172/// int waitUntilEmpty() const;
173/// };
174/// @endcode
175/// Next, implement the queue:
176/// @code
177/// // CREATORS
178/// IntQueue::IntQueue(bsl::size_t capacity, bslma::Allocator *basicAllocator)
179/// : d_data(capacity, basicAllocator)
180/// , d_pushSem(static_cast<int>(capacity))
181/// , d_popSem(0)
182/// , d_pushIdx(0)
183/// , d_popIdx(0)
184/// , d_emptyMutex()
185/// , d_emptyCondition()
186/// {
187/// }
188///
189/// // MANIPULATORS
190/// void IntQueue::disablePopFront()
191/// {
192/// d_popSem.disable();
193/// }
194///
195/// void IntQueue::enablePopFront()
196/// {
197/// d_popSem.enable();
198/// }
199///
200/// int IntQueue::popFront(int *value)
201/// {
202/// // wait for available element
203///
204/// int rv = d_popSem.wait();
205/// if (0 != rv) {
206/// return rv; // RETURN
207/// }
208///
209/// *value = d_data[d_popIdx++ % d_data.size()];
210///
211/// d_pushSem.post(); // signal additional empty element
212///
213/// if (0 == d_popSem.getValue()) {
214/// {
215/// bslmt::LockGuard<bslmt::Mutex> guard(&d_emptyMutex);
216/// }
217/// d_emptyCondition.broadcast();
218/// }
219///
220/// return 0;
221/// }
222///
223/// int IntQueue::pushBack(int value)
224/// {
225/// // wait for an empty element
226///
227/// int rv = d_pushSem.wait();
228/// if (0 != rv) {
229/// return rv; // RETURN
230/// }
231///
232/// d_data[d_pushIdx++ % d_data.size()] = value;
233///
234/// d_popSem.post(); // signal additional available element
235///
236/// return 0;
237/// }
238///
239/// // ACCESSORS
240/// int IntQueue::waitUntilEmpty() const
241/// {
242/// bslmt::LockGuard<bslmt::Mutex> guard(&d_emptyMutex);
243///
244/// int state = d_popSem.getDisabledState();
245///
246/// while (d_popSem.getValue()) {
247/// if (state != d_popSem.getDisabledState()) {
248/// return e_DISABLED; // RETURN
249/// }
250/// d_emptyCondition.wait(&d_emptyMutex);
251/// }
252///
253/// return e_SUCCESS;
254/// }
255/// @endcode
256/// Then, declare an instance of `IntQueue`:
257/// @code
258/// IntQueue queue(10);
259/// @endcode
260/// Next, populate some values:
261/// @code
262/// assert(0 == queue.pushBack(5));
263/// assert(0 == queue.pushBack(7));
264/// assert(0 == queue.pushBack(3));
265/// @endcode
266/// Now, pop and verify the values:
267/// @code
268/// int value;
269///
270/// assert(0 == queue.popFront(&value));
271/// assert(5 == value);
272///
273/// assert(0 == queue.popFront(&value));
274/// assert(7 == value);
275///
276/// assert(0 == queue.popFront(&value));
277/// assert(3 == value);
278/// @endcode
279/// Finally, use `waitUntilEmpty` to verify the queue is empty:
280/// @code
281/// assert(IntQueue::e_SUCCESS == queue.waitUntilEmpty());
282/// @endcode
283/// @}
284/** @} */
285/** @} */
286
287/** @addtogroup bsl
288 * @{
289 */
290/** @addtogroup bslmt
291 * @{
292 */
293/** @addtogroup bslmt_fastpostsemaphore
294 * @{
295 */
296
297#include <bslscm_version.h>
298
299#include <bslmt_condition.h>
301#include <bslmt_lockguard.h>
302#include <bslmt_mutex.h>
303#include <bslmt_threadutil.h>
304
306#include <bsls_libraryfeatures.h>
307#include <bsls_systemclocktype.h>
308#include <bsls_timeinterval.h>
309#include <bsls_types.h>
310
311#ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
312#include <bslmt_chronoutil.h>
313
314#include <bsl_chrono.h>
315#endif
316
317
318namespace bslmt {
319
320 // =======================
321 // class FastPostSemaphore
322 // =======================
323
324/// This class implements a semaphore type, optimized for `post`, for thread
325/// synchronization.
326///
327/// See @ref bslmt_fastpostsemaphore
329
330 // PRIVATE TYPES
335
336 // DATA
337 Impl d_impl;
338
339 private:
340 // NOT IMPLEMENTED
342 FastPostSemaphore& operator=(const FastPostSemaphore&);
343
344 public:
345 // PUBLIC CONSTANTS
347 e_SUCCESS = Impl::e_SUCCESS, // indicates success
348
349 e_DISABLED = Impl::e_DISABLED, // indicates semaphore is
350 // disabled
351
352 e_TIMED_OUT = Impl::e_TIMED_OUT, // indicates operation timed out
353
354 e_WOULD_BLOCK = Impl::e_WOULD_BLOCK, // indicates operation would
355 // block ('tryWait')
356
357 e_FAILED = Impl::e_FAILED // indicates failure reported
358 // from 'd_condition'
359 };
360
361 // CREATORS
362
363 /// Create a `FastPostSemaphore` object initially having a count of 0.
364 /// Optionally specify a `clockType` indicating the type of the system
365 /// clock against which the `bsls::TimeInterval` `absTime` timeouts
366 /// passed to the `timedWait` method are to be interpreted (see
367 /// {Supported Clock-Types} in the component-level documentation). If
368 /// `clockType` is not specified then the realtime system clock is used.
369 explicit
372
373#ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
374 /// Create a `FastPostSemaphore` object initially having a count of 0.
375 /// Use the realtime system clock as the clock against which the
376 /// `absTime` timeouts passed to the `timedWait` methods are interpreted
377 /// (see {Supported Clock-Types} in the component-level documentation).
378 explicit
379 FastPostSemaphore(const bsl::chrono::system_clock&);
380
381 /// Create a `FastPostSemaphore` object initially having a count of 0.
382 /// Use the monotonic system clock as the clock against which the
383 /// `absTime` timeouts passed to the `timedWait` methods are interpreted
384 /// (see {Supported Clock-Types} in the component-level documentation).
385 explicit
386 FastPostSemaphore(const bsl::chrono::steady_clock&);
387#endif
388
389 /// Create a `FastPostSemaphore` object initially having the specified
390 /// `count`. Optionally specify a `clockType` indicating the type of
391 /// the system clock against which the `bsls::TimeInterval` `absTime`
392 /// timeouts passed to the `timedWait` method are to be interpreted (see
393 /// {Supported Clock-Types} in the component-level documentation). If
394 /// `clockType` is not specified then the realtime system clock is used.
395 explicit
397 int count,
399
400#ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
401 /// Create a `FastPostSemaphore` object initially having the specified
402 /// `count`. Use the realtime system clock as the clock against which
403 /// the `absTime` timeouts passed to the `timedWait` methods are
404 /// interpreted (see {Supported Clock-Types} in the component-level
405 /// documentation).
406 FastPostSemaphore(int count, const bsl::chrono::system_clock&);
407
408 /// Create a `FastPostSemaphore` object initially having the specified
409 /// `count`. Use the monotonic system clock as the clock against which
410 /// the `absTime` timeouts passed to the `timedWait` methods are
411 /// interpreted (see {Supported Clock-Types} in the component-level
412 /// documentation).
413 FastPostSemaphore(int count, const bsl::chrono::steady_clock&);
414#endif
415
417 // Destroy this object.
418
419 // MANIPULATORS
420
421 /// Enable waiting on this semaphore. If the semaphore is not disabled,
422 /// this call has no effect.
423 void enable();
424
425 /// Disable waiting on this semaphore. All subsequent invocations of
426 /// `wait`, `tryWait`, and `timedWait` will fail immediately. All
427 /// blocked invocations of `wait` and `timedWait` will fail immediately.
428 /// If the semaphore is already disabled, this method will have no
429 /// effect.
430 void disable();
431
432 /// Atomically increment the count of this semaphore.
433 void post();
434
435 /// Atomically increase the count of this semaphore by the specified `value`.
436 ///
437 /// \pre The behavior is undefined unless `value > 0`.
438 void post(int value);
439
440 /// Atomically increase the count of this semaphore by the specified
441 /// `value`. If the resources available to this semaphore is greater
442 /// than or equal to the specified `available` and the number of threads
443 /// blocked in this semaphore is greater than or equal to the specified
444 /// `blocked`, always send a signal to potentially wake a waiting thread
445 /// (even if the signal should not be needed).
446 ///
447 /// \pre The behavior is undefined unless `value > 0`.
448 /// \note Note that this method is provided to
449 /// help mitigate issues in the implementation of underlying
450 /// synchronization primitives.
451 void postWithRedundantSignal(int value, int available, int blocked);
452
453 /// If the count of this semaphore is positive, reduce the count by the
454 /// lesser of the count and the specified `maximumToTake` and return the
455 /// magnitude of the change to the count. Otherwise, do nothing and
456 /// return 0.
457 int take(int maximumToTake);
458
459 /// If the count of this semaphore is positive, reduce the count to 0
460 /// and return the original value of the count. Otherwise, do nothing
461 /// and return 0.
462 int takeAll();
463
464 /// If this semaphore is initially disabled, or becomes disabled while
465 /// blocking, return `e_DISABLED` with no effect on the count.
466 /// Otherwise, block until the count of this semaphore is a positive
467 /// value or the specified `absTime` timeout expires. If the count of
468 /// this semaphore is a positive value, return 0 and atomically
469 /// decrement the count. If the `absTime` timeout expires, return
470 /// `e_TIMED_OUT` with no effect on the count. Return `e_FAILED` if an
471 /// error occurs. Errors are unrecoverable. After an error, the
472 /// semaphore may be destroyed, but any other use has undefined
473 /// behavior. `absTime` is an *absolute* time represented as an
474 /// interval from some epoch, which is determined by the clock indicated
475 /// at construction (see {Supported Clock-Types} in the component
476 /// documentation).
477 int timedWait(const bsls::TimeInterval& absTime);
478
479#ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
480 /// If this semaphore is initially disabled, or becomes disabled while
481 /// blocking, return `e_DISABLED` with no effect on the count.
482 /// Otherwise, block until the count of this semaphore is a positive
483 /// value or the specified `absTime` timeout expires. If the count of
484 /// this semaphore is a positive value, return 0 and atomically
485 /// decrement the count. If the `absTime` timeout expires, return
486 /// `e_TIMEDOUT` with no effect on the count. Return `e_FAILED` if an
487 /// error occurs. Errors are unrecoverable. After an error, the
488 /// semaphore may be destroyed, but any other use has undefined
489 /// behavior. `absTime` is an *absolute* time represented as an
490 /// interval from some epoch, which is determined by the clock indicated
491 /// at construction (see {Supported Clock-Types} in the component
492 /// documentation).
493 template <class CLOCK, class DURATION>
494 int timedWait(const bsl::chrono::time_point<CLOCK, DURATION>& absTime);
495#endif
496
497 /// If this semaphore is initially disabled, return `e_DISABLED` with no
498 /// effect on the count. Otherwise, if the count of this semaphore is a
499 /// positive value, return 0 and atomically decrement the count. If
500 /// this semaphore is not disabled and the count of this semaphore is
501 /// not a positive value, return `e_WOULD_BLOCK` with no effect on the
502 /// count.
503 int tryWait();
504
505 /// If this semaphore is initially disabled, or becomes disabled while
506 /// blocking, return `e_DISABLED` with no effect on the count.
507 /// Otherwise, block until the count of this semaphore is a positive
508 /// value, return 0 and atomically decrement the count. Return
509 /// `e_FAILED` if an error occurs.
510 int wait();
511
512 // ACCESSORS
513
514 /// Return the clock type used for timeouts.
516
517 /// Return an odd value if this semaphore is wait disabled, and an even
518 /// value otherwise. The returned value can be used to detect a rapid
519 /// short sequence of `disable` and `enable` invocations by comparing
520 /// the value returned by `getDisabledState` before and after the
521 /// sequence. For example, for any initial state of a semaphore
522 /// instance `obj`:
523 /// @code
524 /// int state = obj.getDisabledState();
525 /// obj.disable();
526 /// obj.enable();
527 /// ASSERT(state != obj.getDisabledState());
528 /// @endcode
529 /// This functionality is useful in higher-level components to determine
530 /// if this semaphore was disabled during an operation.
531 int getDisabledState() const;
532
533 /// Return the current value (`count > 0 ? count : 0`) of this
534 /// semaphore.
535 int getValue() const;
536
537 /// Return `true` if this semaphore is wait disabled, and `false` otherwise.
538 ///
539 /// \note Note that the semaphore is created in the "wait enabled"
540 /// state.
541 bool isDisabled() const;
542};
543
544// ============================================================================
545// INLINE DEFINITIONS
546// ============================================================================
547
548 // -----------------------
549 // class FastPostSemaphore
550 // -----------------------
551
552// CREATORS
553inline
554FastPostSemaphore::FastPostSemaphore(bsls::SystemClockType::Enum clockType)
555: d_impl(clockType)
556{
557}
558
559#ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
560inline
561FastPostSemaphore::FastPostSemaphore(const bsl::chrono::system_clock&)
562: d_impl(bsls::SystemClockType::e_REALTIME)
563{
564}
565
566inline
567FastPostSemaphore::FastPostSemaphore(const bsl::chrono::steady_clock&)
568: d_impl(bsls::SystemClockType::e_MONOTONIC)
569{
570}
571#endif
572
573inline
574FastPostSemaphore::FastPostSemaphore(int count,
576: d_impl(count, clockType)
577{
578}
579
580#ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
581inline
582FastPostSemaphore::FastPostSemaphore(int count,
583 const bsl::chrono::system_clock&)
584: d_impl(count, bsls::SystemClockType::e_REALTIME)
585{
586}
587
588inline
589FastPostSemaphore::FastPostSemaphore(int count,
590 const bsl::chrono::steady_clock&)
591: d_impl(count, bsls::SystemClockType::e_MONOTONIC)
592{
593}
594#endif
595
596// MANIPULATORS
597inline
599{
600 d_impl.disable();
601}
602
603inline
605{
606 d_impl.enable();
607}
608
609inline
611{
612 d_impl.post();
613}
614
615inline
617{
618 d_impl.post(value);
619}
620
621inline
623 int available,
624 int blocked)
625{
626 d_impl.postWithRedundantSignal(value, available, blocked);
627}
628
629inline
630int FastPostSemaphore::take(int maximumToTake)
631{
632 return d_impl.take(maximumToTake);
633}
634
635inline
637{
638 return d_impl.takeAll();
639}
640
641inline
643{
644 return d_impl.timedWait(absTime);
645}
646
647#ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
648template <class CLOCK, class DURATION>
649inline
651 const bsl::chrono::time_point<CLOCK, DURATION>& absTime)
652{
653 return bslmt::ChronoUtil::timedWait(this, absTime);
654}
655#endif
656
657inline
659{
660 return d_impl.tryWait();
661}
662
663inline
665{
666 return d_impl.wait();
667}
668
669// ACCESSORS
670inline
675
676inline
678{
679 return d_impl.getDisabledState();
680}
681
682inline
684{
685 return d_impl.getValue();
686}
687
688inline
690{
691 return d_impl.isDisabled();
692}
693
694} // close package namespace
695
696
697#endif
698
699// ----------------------------------------------------------------------------
700// Copyright 2019 Bloomberg Finance L.P.
701//
702// Licensed under the Apache License, Version 2.0 (the "License");
703// you may not use this file except in compliance with the License.
704// You may obtain a copy of the License at
705//
706// http://www.apache.org/licenses/LICENSE-2.0
707//
708// Unless required by applicable law or agreed to in writing, software
709// distributed under the License is distributed on an "AS IS" BASIS,
710// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
711// See the License for the specific language governing permissions and
712// limitations under the License.
713// ----------------------------- END-OF-FILE ----------------------------------
714
715/** @} */
716/** @} */
717/** @} */
Definition bslmt_condition.h:220
Definition bslmt_fastpostsemaphoreimpl.h:145
int getValue() const
Definition bslmt_fastpostsemaphoreimpl.h:947
int takeAll()
Definition bslmt_fastpostsemaphoreimpl.h:862
void enable()
Definition bslmt_fastpostsemaphoreimpl.h:698
void postWithRedundantSignal(int value, int available, int blocked)
Definition bslmt_fastpostsemaphoreimpl.h:791
void disable()
Definition bslmt_fastpostsemaphoreimpl.h:650
bsls::SystemClockType::Enum clockType() const
Return the clock type used for timeouts.
Definition bslmt_fastpostsemaphoreimpl.h:928
int wait()
Definition bslmt_fastpostsemaphoreimpl.h:907
int tryWait()
Definition bslmt_fastpostsemaphoreimpl.h:888
int timedWait(const bsls::TimeInterval &absTime)
Definition bslmt_fastpostsemaphoreimpl.h:870
void post()
Atomically increment the count of this semaphore.
Definition bslmt_fastpostsemaphoreimpl.h:734
int take(int maximumToTake)
Definition bslmt_fastpostsemaphoreimpl.h:830
int getDisabledState() const
Definition bslmt_fastpostsemaphoreimpl.h:936
Definition bslmt_fastpostsemaphore.h:328
void post()
Atomically increment the count of this semaphore.
Definition bslmt_fastpostsemaphore.h:610
bsls::SystemClockType::Enum clockType() const
Return the clock type used for timeouts.
Definition bslmt_fastpostsemaphore.h:671
bool isDisabled() const
Definition bslmt_fastpostsemaphore.h:689
int wait()
Definition bslmt_fastpostsemaphore.h:664
int tryWait()
Definition bslmt_fastpostsemaphore.h:658
void enable()
Definition bslmt_fastpostsemaphore.h:604
int getValue() const
Definition bslmt_fastpostsemaphore.h:683
ReturnValue
Definition bslmt_fastpostsemaphore.h:346
@ e_FAILED
Definition bslmt_fastpostsemaphore.h:357
@ e_SUCCESS
Definition bslmt_fastpostsemaphore.h:347
@ e_DISABLED
Definition bslmt_fastpostsemaphore.h:349
@ e_TIMED_OUT
Definition bslmt_fastpostsemaphore.h:352
@ e_WOULD_BLOCK
Definition bslmt_fastpostsemaphore.h:354
void disable()
Definition bslmt_fastpostsemaphore.h:598
int timedWait(const bsls::TimeInterval &absTime)
Definition bslmt_fastpostsemaphore.h:642
int take(int maximumToTake)
Definition bslmt_fastpostsemaphore.h:630
int takeAll()
Definition bslmt_fastpostsemaphore.h:636
void postWithRedundantSignal(int value, int available, int blocked)
Definition bslmt_fastpostsemaphore.h:622
int getDisabledState() const
Definition bslmt_fastpostsemaphore.h:677
Definition bslmt_mutex.h:317
Definition bsls_timeinterval.h:307
#define BSLS_IDENT(str)
BSLS_IDENT() - insert string into .comment binary segment (if supported)
Definition bsls_ident.h:238
Definition bslmt_barrier.h:344
Definition bdlt_iso8601util.h:707
Definition bslmt_threadutil.h:379
Definition bsls_atomicoperations.h:836
Enum
Definition bsls_systemclocktype.h:119
@ e_REALTIME
Definition bsls_systemclocktype.h:122