BDE 4.14.0 Production release
|
#include <bdlmt_signaler.h>
Public Types | |
typedef void | ResultType |
Public Member Functions | |
Signaler (bslma::Allocator *basicAllocator=0) | |
~Signaler () | |
template<class t_FUNC > | |
SignalerConnection | connect (BSLS_COMPILERFEATURES_FORWARD_REF(t_FUNC) slot, int group=0) |
void | disconnectAllSlots () BSLS_KEYWORD_NOEXCEPT |
void | disconnectAllSlotsAndWait () BSLS_KEYWORD_NOEXCEPT |
void | disconnectGroup (int group) BSLS_KEYWORD_NOEXCEPT |
void | disconnectGroupAndWait (int group) BSLS_KEYWORD_NOEXCEPT |
bsl::size_t | slotCount () const |
Friends | |
struct | Signaler_Invocable< Signaler< t_PROT >, t_PROT > |
This class template provides a thread-safe signaler that executes connected slots when invoked via its call operator. t_PROT
is a function signature and must have a return type of void
. The callable objects assigned to the slots may have return types other than void
, in which case their return values will be discarded.
See bdlmt_signaler
typedef void bdlmt::Signaler< t_PROT >::ResultType |
|
explicit |
Create a Signaler
object having no connected slots. Optionally specify a basicAllocator
used to supply memory. If basicAllocator
is 0, the currently installed default allocator is used. Note that the supplied allocator must remain valid until all connection objects associated with this signaler are destroyed.
|
inline |
Destroy this object. Call disconnectAllSlots()
. The behavior is undefined if this function is invoked from a slot connected to this signaler.
|
inline |
Connect the specified slot
, a callable object which must meet the Slot Object Requirements
described in the component documentation, to this signaler. Optionally specify a group
used to order slots upon invocation. Return an instance of SignalerConnection
representing the created connection. This function meets the strong exception guarantee. Note that the connected slot may be called by a signal emitted from another thread before this function completes. Also note that it is unspecified whether connecting a slot while the signaler is emitting will result in the slot being called immediately. Note that t_FUNC
may have a return type other than void
, but in that case, when the slot is called, the return value will be discarded.
|
inline |
Disconnect all slots, if any, connected to this signaler. Any signals emitted on the corresponding signaler that happen after this call to disconnect completes will not call any slots that were connected prior to this call. Throws nothing. Note that this function does not block the calling thread pending completion of ongoing signals emitted on the signaler. Also note that it is unspecified how many slots, if any, will be called by any invocation on the signaler that begins before this function completes. Also note that if a slot is connected to this signaler during a call to this function, it is unspecified whether that slot will be disconnected.
|
inline |
Disconnect all slots, if any, connected to this signaler. Any signals emitted on the corresponding signaler that happens after this call to disconnect completes will not call any slots that were connected prior to this call. This function blocks the calling thread pending completion of all ongoing signals being emitted on the signaler. Throws nothing. The behavior is undefined if this method is called from a slot connected to the signaler. Note that it is unspecified how many slots, if any, will be called by any invocation on the signaler that begins before this function completes. Also note that if a slot is connected to this signaler during a call to this function, it is unspecified whether that slot will be disconnected.
|
inline |
Disconnect all slots, if any, connected to this signaler in the specified group
. Any signal emitted on the corresponding signaler that happens after this call to disconnect completes will not call any slots in group
that were connected prior to this call. Throws nothing. Note that this function does not block the calling thread pending completion of ongoing signals emitted on the signaler. Also note that it is unspecified how many affected slots, if any, will be signalled to by any invocation on the signaler that begins before this function completes. Also note that if a slot in group
is connected to this signaler during a call to this function, it is unspecified whether that slot will be disconnected.
|
inline |
Disconnect all slots, if any, connected to this signaler in the specified group
. Any signal emitted on the corresponding signaler that happens after this call to disconnect completes will not call any slots in group
that were connected prior to this call. This function blocks the calling thread pending completion of ongoing signals being emitted on the signaler. Throws nothing. The behavior is undefined if this method is called from a slot connected to the signaler. Note that it is unspecified how many affected slots, if any, will be signaled to by any emission on the signaler that begins before this function completes. Also note that if a slot in group
is connected to this signaler during a call to this function, it is unspecified whether that slot will be disconnected.
|
inline |
Return the number of slots connected to this signaler. Note that the value returned by slotCount()
is approximate if the signaler is being simultaneously manipulated by other threads.
|
friend |