BDE 4.14.0 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/// // NOT IMPLEMENTED
110/// IntQueue(const IntQueue&);
111/// IntQueue& operator=(const IntQueue&);
112///
113/// public:
114/// // PUBLIC CONSTANTS
115/// enum ReturnValue {
116/// e_SUCCESS = bslmt::FastPostSemaphore::e_SUCCESS, // indicates
117/// // success
118///
119/// e_DISABLED = bslmt::FastPostSemaphore::e_DISABLED, // indicates
120/// // queue is
121/// // disabled
122///
123/// e_FAILED = bslmt::FastPostSemaphore::e_FAILED // indicates
124/// // failure
125/// };
126///
127/// // CREATORS
128///
129/// /// Create an `IntQueue` object with the specified `capacity`.
130/// /// Optionally specify a `basicAllocator` used to supply memory. If
131/// /// `basicAllocator` is 0, the currently installed default allocator
132/// /// is used.
133/// explicit
134/// IntQueue(bsl::size_t capacity, bslma::Allocator *basicAllocator = 0);
135///
136/// /// Destroy this object.
137/// //! ~IntQueue() = default;
138///
139/// // MANIPULATORS
140///
141/// /// Disable dequeueing from this queue. All subsequent invocations
142/// /// of `popFront` and `waitUntilEmpty` will fail immediately. All
143/// /// blocked invocations of `popFront` and `waitUntilEmpty` will fail
144/// /// immediately. If the queue is already dequeue disabled, this
145/// /// method has no effect.
146/// void disablePopFront();
147///
148/// /// Enable dequeuing. If the queue is not dequeue disabled, this method
149/// /// has no effect.
150/// void enablePopFront();
151///
152/// /// Remove the element from the front of this queue and load that
153/// /// element into the specified `value`. If the queue is empty,
154/// /// block until it is not empty. Return 0 on success, and a nonzero
155/// /// value if the queue is disabled.
156/// int popFront(int *value);
157///
158/// /// Append the specified `value` to the back of this queue, blocking
159/// /// until either space is available - if necessary - or the queue is
160/// /// disabled. Return 0 on success, and a nonzero value if the queue
161/// /// is disabled.
162/// int pushBack(int value);
163///
164/// // ACCESSORS
165///
166/// /// Block until all the elements in this queue are removed. Return
167/// /// 0 on success, and a non-zero value if the queue is not empty and
168/// /// `isPopFrontDisabled()`. A blocked thread waiting for the queue
169/// /// to empty will return a non-zero value if `disablePopFront` is
170/// /// invoked.
171/// int waitUntilEmpty() const;
172/// };
173/// @endcode
174/// Next, implement the queue:
175/// @code
176/// // CREATORS
177/// IntQueue::IntQueue(bsl::size_t capacity, bslma::Allocator *basicAllocator)
178/// : d_data(capacity, basicAllocator)
179/// , d_pushSem(static_cast<int>(capacity))
180/// , d_popSem(0)
181/// , d_pushIdx(0)
182/// , d_popIdx(0)
183/// , d_emptyMutex()
184/// , d_emptyCondition()
185/// {
186/// }
187///
188/// // MANIPULATORS
189/// void IntQueue::disablePopFront()
190/// {
191/// d_popSem.disable();
192/// }
193///
194/// void IntQueue::enablePopFront()
195/// {
196/// d_popSem.enable();
197/// }
198///
199/// int IntQueue::popFront(int *value)
200/// {
201/// // wait for available element
202///
203/// int rv = d_popSem.wait();
204/// if (0 != rv) {
205/// return rv; // RETURN
206/// }
207///
208/// *value = d_data[d_popIdx++ % d_data.size()];
209///
210/// d_pushSem.post(); // signal additional empty element
211///
212/// if (0 == d_popSem.getValue()) {
213/// {
214/// bslmt::LockGuard<bslmt::Mutex> guard(&d_emptyMutex);
215/// }
216/// d_emptyCondition.broadcast();
217/// }
218///
219/// return 0;
220/// }
221///
222/// int IntQueue::pushBack(int value)
223/// {
224/// // wait for an empty element
225///
226/// int rv = d_pushSem.wait();
227/// if (0 != rv) {
228/// return rv; // RETURN
229/// }
230///
231/// d_data[d_pushIdx++ % d_data.size()] = value;
232///
233/// d_popSem.post(); // signal additional available element
234///
235/// return 0;
236/// }
237///
238/// // ACCESSORS
239/// int IntQueue::waitUntilEmpty() const
240/// {
241/// bslmt::LockGuard<bslmt::Mutex> guard(&d_emptyMutex);
242///
243/// int state = d_popSem.getDisabledState();
244///
245/// while (d_popSem.getValue()) {
246/// if (state != d_popSem.getDisabledState()) {
247/// return e_DISABLED; // RETURN
248/// }
249/// d_emptyCondition.wait(&d_emptyMutex);
250/// }
251///
252/// return e_SUCCESS;
253/// }
254/// @endcode
255/// Then, declare an instance of `IntQueue`:
256/// @code
257/// IntQueue queue(10);
258/// @endcode
259/// Next, populate some values:
260/// @code
261/// assert(0 == queue.pushBack(5));
262/// assert(0 == queue.pushBack(7));
263/// assert(0 == queue.pushBack(3));
264/// @endcode
265/// Now, pop and verify the values:
266/// @code
267/// int value;
268///
269/// assert(0 == queue.popFront(&value));
270/// assert(5 == value);
271///
272/// assert(0 == queue.popFront(&value));
273/// assert(7 == value);
274///
275/// assert(0 == queue.popFront(&value));
276/// assert(3 == value);
277/// @endcode
278/// Finally, use `waitUntilEmpty` to verify the queue is empty:
279/// @code
280/// assert(IntQueue::e_SUCCESS == queue.waitUntilEmpty());
281/// @endcode
282/// @}
283/** @} */
284/** @} */
285
286/** @addtogroup bsl
287 * @{
288 */
289/** @addtogroup bslmt
290 * @{
291 */
292/** @addtogroup bslmt_fastpostsemaphore
293 * @{
294 */
295
296#include <bslscm_version.h>
297
298#include <bslmt_condition.h>
300#include <bslmt_lockguard.h>
301#include <bslmt_mutex.h>
302#include <bslmt_threadutil.h>
303
305#include <bsls_libraryfeatures.h>
306#include <bsls_systemclocktype.h>
307#include <bsls_timeinterval.h>
308#include <bsls_types.h>
309
310#ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
311#include <bslmt_chronoutil.h>
312
313#include <bsl_chrono.h>
314#endif
315
316
317namespace bslmt {
318
319 // =======================
320 // class FastPostSemaphore
321 // =======================
322
323/// This class implements a semaphore type, optimized for `post`, for thread
324/// synchronization.
325///
326/// See @ref bslmt_fastpostsemaphore
328
329 // PRIVATE TYPES
334
335 // DATA
336 Impl d_impl;
337
338 // NOT IMPLEMENTED
340 FastPostSemaphore& operator=(const FastPostSemaphore&);
341
342 public:
343 // PUBLIC CONSTANTS
345 e_SUCCESS = Impl::e_SUCCESS, // indicates success
346
347 e_DISABLED = Impl::e_DISABLED, // indicates semaphore is
348 // disabled
349
350 e_TIMED_OUT = Impl::e_TIMED_OUT, // indicates operation timed out
351
352 e_WOULD_BLOCK = Impl::e_WOULD_BLOCK, // indicates operation would
353 // block ('tryWait')
354
355 e_FAILED = Impl::e_FAILED // indicates failure reported
356 // from 'd_condition'
357 };
358
359 // CREATORS
360
361 /// Create a `FastPostSemaphore` object initially having a count of 0.
362 /// Optionally specify a `clockType` indicating the type of the system
363 /// clock against which the `bsls::TimeInterval` `absTime` timeouts
364 /// passed to the `timedWait` method are to be interpreted (see
365 /// {Supported Clock-Types} in the component-level documentation). If
366 /// `clockType` is not specified then the realtime system clock is used.
367 explicit
370
371#ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
372 /// Create a `FastPostSemaphore` object initially having a count of 0.
373 /// Use the realtime system clock as the clock against which the
374 /// `absTime` timeouts passed to the `timedWait` methods are interpreted
375 /// (see {Supported Clock-Types} in the component-level documentation).
376 explicit
377 FastPostSemaphore(const bsl::chrono::system_clock&);
378
379 /// Create a `FastPostSemaphore` object initially having a count of 0.
380 /// Use the monotonic system clock as the clock against which the
381 /// `absTime` timeouts passed to the `timedWait` methods are interpreted
382 /// (see {Supported Clock-Types} in the component-level documentation).
383 explicit
384 FastPostSemaphore(const bsl::chrono::steady_clock&);
385#endif
386
387 /// Create a `FastPostSemaphore` object initially having the specified
388 /// `count`. Optionally specify a `clockType` indicating the type of
389 /// the system clock against which the `bsls::TimeInterval` `absTime`
390 /// timeouts passed to the `timedWait` method are to be interpreted (see
391 /// {Supported Clock-Types} in the component-level documentation). If
392 /// `clockType` is not specified then the realtime system clock is used.
393 explicit
395 int count,
397
398#ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
399 /// Create a `FastPostSemaphore` object initially having the specified
400 /// `count`. Use the realtime system clock as the clock against which
401 /// the `absTime` timeouts passed to the `timedWait` methods are
402 /// interpreted (see {Supported Clock-Types} in the component-level
403 /// documentation).
404 FastPostSemaphore(int count, const bsl::chrono::system_clock&);
405
406 /// Create a `FastPostSemaphore` object initially having the specified
407 /// `count`. Use the monotonic system clock as the clock against which
408 /// the `absTime` timeouts passed to the `timedWait` methods are
409 /// interpreted (see {Supported Clock-Types} in the component-level
410 /// documentation).
411 FastPostSemaphore(int count, const bsl::chrono::steady_clock&);
412#endif
413
415 // Destroy this object.
416
417 // MANIPULATORS
418
419 /// Enable waiting on this semaphore. If the semaphore is not disabled,
420 /// this call has no effect.
421 void enable();
422
423 /// Disable waiting on this semaphore. All subsequent invocations of
424 /// `wait`, `tryWait`, and `timedWait` will fail immediately. All
425 /// blocked invocations of `wait` and `timedWait` will fail immediately.
426 /// If the semaphore is already disabled, this method will have no
427 /// effect.
428 void disable();
429
430 /// Atomically increment the count of this semaphore.
431 void post();
432
433 /// Atomically increase the count of this semaphore by the specified
434 /// `value`. The behavior is undefined unless `value > 0`.
435 void post(int value);
436
437 /// Atomically increase the count of this semaphore by the specified
438 /// `value`. If the resources available to this semaphore is greater
439 /// than or equal to the specified `available` and the number of threads
440 /// blocked in this semaphore is greater than or equal to the specified
441 /// `blocked`, always send a signal to potentially wake a waiting thread
442 /// (even if the signal should not be needed). The behavior is
443 /// undefined unless `value > 0`. Note that this method is provided to
444 /// help mitigate issues in the implementation of underlying
445 /// synchronization primitives.
446 void postWithRedundantSignal(int value, int available, int blocked);
447
448 /// If the count of this semaphore is positive, reduce the count by the
449 /// lesser of the count and the specified `maximumToTake` and return the
450 /// magnitude of the change to the count. Otherwise, do nothing and
451 /// return 0.
452 int take(int maximumToTake);
453
454 /// If the count of this semaphore is positive, reduce the count to 0
455 /// and return the original value of the count. Otherwise, do nothing
456 /// and return 0.
457 int takeAll();
458
459 /// If this semaphore is initially disabled, or becomes disabled while
460 /// blocking, return `e_DISABLED` with no effect on the count.
461 /// Otherwise, block until the count of this semaphore is a positive
462 /// value or the specified `absTime` timeout expires. If the count of
463 /// this semaphore is a positive value, return 0 and atomically
464 /// decrement the count. If the `absTime` timeout expires, return
465 /// `e_TIMED_OUT` with no effect on the count. Return `e_FAILED` if an
466 /// error occurs. Errors are unrecoverable. After an error, the
467 /// semaphore may be destroyed, but any other use has undefined
468 /// behavior. `absTime` is an *absolute* time represented as an
469 /// interval from some epoch, which is determined by the clock indicated
470 /// at construction (see {Supported Clock-Types} in the component
471 /// documentation).
472 int timedWait(const bsls::TimeInterval& absTime);
473
474#ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
475 /// If this semaphore is initially disabled, or becomes disabled while
476 /// blocking, return `e_DISABLED` with no effect on the count.
477 /// Otherwise, block until the count of this semaphore is a positive
478 /// value or the specified `absTime` timeout expires. If the count of
479 /// this semaphore is a positive value, return 0 and atomically
480 /// decrement the count. If the `absTime` timeout expires, return
481 /// `e_TIMEDOUT` with no effect on the count. Return `e_FAILED` if an
482 /// error occurs. Errors are unrecoverable. After an error, the
483 /// semaphore may be destroyed, but any other use has undefined
484 /// behavior. `absTime` is an *absolute* time represented as an
485 /// interval from some epoch, which is determined by the clock indicated
486 /// at construction (see {Supported Clock-Types} in the component
487 /// documentation).
488 template <class CLOCK, class DURATION>
489 int timedWait(const bsl::chrono::time_point<CLOCK, DURATION>& absTime);
490#endif
491
492 /// If this semaphore is initially disabled, return `e_DISABLED` with no
493 /// effect on the count. Otherwise, if the count of this semaphore is a
494 /// positive value, return 0 and atomically decrement the count. If
495 /// this semaphore is not disabled and the count of this semaphore is
496 /// not a positive value, return `e_WOULD_BLOCK` with no effect on the
497 /// count.
498 int tryWait();
499
500 /// If this semaphore is initially disabled, or becomes disabled while
501 /// blocking, return `e_DISABLED` with no effect on the count.
502 /// Otherwise, block until the count of this semaphore is a positive
503 /// value, return 0 and atomically decrement the count. Return
504 /// `e_FAILED` if an error occurs.
505 int wait();
506
507 // ACCESSORS
508
509 /// Return the clock type used for timeouts.
511
512 /// Return an odd value if this semaphore is wait disabled, and an even
513 /// value otherwise. The returned value can be used to detect a rapid
514 /// short sequence of `disable` and `enable` invocations by comparing
515 /// the value returned by `getDisabledState` before and after the
516 /// sequence. For example, for any initial state of a semaphore
517 /// instance `obj`:
518 /// @code
519 /// int state = obj.getDisabledState();
520 /// obj.disable();
521 /// obj.enable();
522 /// ASSERT(state != obj.getDisabledState());
523 /// @endcode
524 /// This functionality is useful in higher-level components to determine
525 /// if this semaphore was disabled during an operation.
526 int getDisabledState() const;
527
528 /// Return the current value (`count > 0 ? count : 0`) of this
529 /// semaphore.
530 int getValue() const;
531
532 /// Return `true` if this semaphore is wait disabled, and `false`
533 /// otherwise. Note that the semaphore is created in the "wait enabled"
534 /// state.
535 bool isDisabled() const;
536};
537
538// ============================================================================
539// INLINE DEFINITIONS
540// ============================================================================
541
542 // -----------------------
543 // class FastPostSemaphore
544 // -----------------------
545
546// CREATORS
547inline
548FastPostSemaphore::FastPostSemaphore(bsls::SystemClockType::Enum clockType)
549: d_impl(clockType)
550{
551}
552
553#ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
554inline
555FastPostSemaphore::FastPostSemaphore(const bsl::chrono::system_clock&)
556: d_impl(bsls::SystemClockType::e_REALTIME)
557{
558}
559
560inline
561FastPostSemaphore::FastPostSemaphore(const bsl::chrono::steady_clock&)
562: d_impl(bsls::SystemClockType::e_MONOTONIC)
563{
564}
565#endif
566
567inline
568FastPostSemaphore::FastPostSemaphore(int count,
570: d_impl(count, clockType)
571{
572}
573
574#ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
575inline
576FastPostSemaphore::FastPostSemaphore(int count,
577 const bsl::chrono::system_clock&)
578: d_impl(count, bsls::SystemClockType::e_REALTIME)
579{
580}
581
582inline
583FastPostSemaphore::FastPostSemaphore(int count,
584 const bsl::chrono::steady_clock&)
585: d_impl(count, bsls::SystemClockType::e_MONOTONIC)
586{
587}
588#endif
589
590// MANIPULATORS
591inline
593{
594 d_impl.disable();
595}
596
597inline
599{
600 d_impl.enable();
601}
602
603inline
605{
606 d_impl.post();
607}
608
609inline
611{
612 d_impl.post(value);
613}
614
615inline
617 int available,
618 int blocked)
619{
620 d_impl.postWithRedundantSignal(value, available, blocked);
621}
622
623inline
624int FastPostSemaphore::take(int maximumToTake)
625{
626 return d_impl.take(maximumToTake);
627}
628
629inline
631{
632 return d_impl.takeAll();
633}
634
635inline
637{
638 return d_impl.timedWait(absTime);
639}
640
641#ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
642template <class CLOCK, class DURATION>
643inline
645 const bsl::chrono::time_point<CLOCK, DURATION>& absTime)
646{
647 return bslmt::ChronoUtil::timedWait(this, absTime);
648}
649#endif
650
651inline
653{
654 return d_impl.tryWait();
655}
656
657inline
659{
660 return d_impl.wait();
661}
662
663// ACCESSORS
664inline
669
670inline
672{
673 return d_impl.getDisabledState();
674}
675
676inline
678{
679 return d_impl.getValue();
680}
681
682inline
684{
685 return d_impl.isDisabled();
686}
687
688} // close package namespace
689
690
691#endif
692
693// ----------------------------------------------------------------------------
694// Copyright 2019 Bloomberg Finance L.P.
695//
696// Licensed under the Apache License, Version 2.0 (the "License");
697// you may not use this file except in compliance with the License.
698// You may obtain a copy of the License at
699//
700// http://www.apache.org/licenses/LICENSE-2.0
701//
702// Unless required by applicable law or agreed to in writing, software
703// distributed under the License is distributed on an "AS IS" BASIS,
704// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
705// See the License for the specific language governing permissions and
706// limitations under the License.
707// ----------------------------- END-OF-FILE ----------------------------------
708
709/** @} */
710/** @} */
711/** @} */
Definition bslmt_condition.h:220
Definition bslmt_fastpostsemaphoreimpl.h:145
int getValue() const
Definition bslmt_fastpostsemaphoreimpl.h:936
int takeAll()
Definition bslmt_fastpostsemaphoreimpl.h:851
void enable()
Definition bslmt_fastpostsemaphoreimpl.h:687
void postWithRedundantSignal(int value, int available, int blocked)
Definition bslmt_fastpostsemaphoreimpl.h:780
void disable()
Definition bslmt_fastpostsemaphoreimpl.h:639
bsls::SystemClockType::Enum clockType() const
Return the clock type used for timeouts.
Definition bslmt_fastpostsemaphoreimpl.h:917
int wait()
Definition bslmt_fastpostsemaphoreimpl.h:896
int tryWait()
Definition bslmt_fastpostsemaphoreimpl.h:877
int timedWait(const bsls::TimeInterval &absTime)
Definition bslmt_fastpostsemaphoreimpl.h:859
void post()
Atomically increment the count of this semaphore.
Definition bslmt_fastpostsemaphoreimpl.h:723
int take(int maximumToTake)
Definition bslmt_fastpostsemaphoreimpl.h:819
int getDisabledState() const
Definition bslmt_fastpostsemaphoreimpl.h:925
Definition bslmt_fastpostsemaphore.h:327
void post()
Atomically increment the count of this semaphore.
Definition bslmt_fastpostsemaphore.h:604
bsls::SystemClockType::Enum clockType() const
Return the clock type used for timeouts.
Definition bslmt_fastpostsemaphore.h:665
bool isDisabled() const
Definition bslmt_fastpostsemaphore.h:683
int wait()
Definition bslmt_fastpostsemaphore.h:658
int tryWait()
Definition bslmt_fastpostsemaphore.h:652
void enable()
Definition bslmt_fastpostsemaphore.h:598
int getValue() const
Definition bslmt_fastpostsemaphore.h:677
ReturnValue
Definition bslmt_fastpostsemaphore.h:344
@ e_FAILED
Definition bslmt_fastpostsemaphore.h:355
@ e_SUCCESS
Definition bslmt_fastpostsemaphore.h:345
@ e_DISABLED
Definition bslmt_fastpostsemaphore.h:347
@ e_TIMED_OUT
Definition bslmt_fastpostsemaphore.h:350
@ e_WOULD_BLOCK
Definition bslmt_fastpostsemaphore.h:352
void disable()
Definition bslmt_fastpostsemaphore.h:592
int timedWait(const bsls::TimeInterval &absTime)
Definition bslmt_fastpostsemaphore.h:636
int take(int maximumToTake)
Definition bslmt_fastpostsemaphore.h:624
int takeAll()
Definition bslmt_fastpostsemaphore.h:630
void postWithRedundantSignal(int value, int available, int blocked)
Definition bslmt_fastpostsemaphore.h:616
int getDisabledState() const
Definition bslmt_fastpostsemaphore.h:671
Definition bslmt_mutex.h:315
Definition bsls_timeinterval.h:301
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
Definition bslmt_barrier.h:344
Definition bdlt_iso8601util.h:691
static int timedWait(PRIMITIVE *primitive, const bsl::chrono::time_point< CLOCK, DURATION > &absTime)
Definition bslmt_chronoutil.h:345
Definition bslmt_threadutil.h:375
Definition bsls_atomicoperations.h:834
Enum
Definition bsls_systemclocktype.h:117
@ e_REALTIME
Definition bsls_systemclocktype.h:120